Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if a Google Play purchase is made from a test account or a regular account

I'm building an app where I have to detect if a purchase is a test purchase (made from a test account) or a real purchase from a real user. Note that the app is already live, and the SKU's I'm using are the same as the ones in production.

Google can detect if a purchase is a test, because it shows a message ("This is a test order, yo will not be charged"), but I'm looking for a way to detect that programmatically.

like image 276
user3673952 Avatar asked Oct 30 '22 08:10

user3673952


1 Answers

If it doesn't need to be in real-time, you should be able to rectify it day(s) later by programmatically pulling down the sales reports with gsutil, and then parsing the CSVs for any orders where the title is prefixed with "Test: ".

https://support.google.com/googleplay/android-developer/answer/6135870?p=financial_export&rd=1#export

Download reports from Google Cloud Storage

Monthly reports are available from Google Cloud Storage. Reports are generated daily and accumulated in monthly CSV files. They are stored in a private Google Cloud Storage bucket for your Google Play Developer account.

You can access reports using Google Cloud Storage on your browser or programmatically using gsutil. You can also use other tools to programmatically access your Cloud Storage bucket.

Tip: If you want to import your reports from Google Cloud Storage into BigQuery, you need to convert the CSV files from UTF-16 to UTF-8.

Your Google Cloud Storage bucket ID is listed near the bottom of your Reports pages.

Your bucket ID begins with pubsite_prod_rev (example: pubsite_prod_rev_01234567890987654321).

like image 147
Mason G. Zhwiti Avatar answered Nov 15 '22 07:11

Mason G. Zhwiti