Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum length of Google Play Billing purchase token?

NOTE: This question is not duplicate of What is maximum purchaseToken length provided by google after in app purchases in android? , because that question and answer is concerning AIDL, which is different from the current google play billing library, and the source of the answer is not valid now.

My question is simply "how long the maximum length of the purchase token introduced in Google Play Billing Library."

The documentation does not provide any information about the length of purchase token, although it needs us to store and replace it if necessary.

Any information would be helpful, thanks!

like image 842
Yuki Hashimoto Avatar asked Jul 03 '20 03:07

Yuki Hashimoto


People also ask

What is Google Play's billing system?

Google Play's billing system is a service that enables you to sell digital products and content in your Android app. You can use Google Play's billing system to sell a one-time product or subscriptions on a recurring basis.

Can't connect to Google Play billing?

Log out of your Google account Go to Android Settings > Accounts > Google and tap on Remove account. Data will not be lost as normally all of it will be synced with Google's cloud services (true for Google accounts). Re-add your account then restart your device. Try buying again.

What is purchase token?

Google Play's purchase success screen. A successful purchase also generates a purchase token, which is a unique identifier that represents the user and the product ID for the in-app product they purchased.


1 Answers

We have been working on a v4 system upgrade here and I had the same question setting up the schema for the unique constraint (max length in particular)

Looking at the AIDL data we had the following data shape through 2018 (v3):

Total AIDL Google Purchase Token Count: 476,778

Min Len: 165

Max Len: 187

Avg.Len: 174

While developing for v4 today I snagged some purchase tokens from our license tester purchase activity to do this rather small empirical analysis. Today we had only 15 we could consider and each of those was 144 in length with zero variation. This was a testing license users generating receipt data for us in app using the actual purchase flow (and I suspect that is why they are equal in length.)

the v4 sample: 144 avg/min/max len

The length of the last 15 captured purchase token string lengths

As we get more data (especially from our live early access release coming up) I will endeavor to post more current data (prod me in three months if I don't return. Happy to share findings.) In the AIDL system I had a max text size limit of 400 on the field btw. I think I am just going to keep that and log any occurrence that exceeds that and would require more.

NOTE: I should point out all our data for v4 is consumable, the v3 data was one time entitlements. I don't how much a difference that makes...

NOTE: While working on this v4 system, v5 dropped (2022-05-11)... Looks like its mostly enhancements for subs. I will address those later. We're not enabling subscriptions just yet, but intend too.

edit I initially said v3 everywhere, I meant v4 billing for the new data... our previous system was Billing v3 circa ~2018.

like image 74
Hunter-Orionnoir Avatar answered Oct 19 '22 20:10

Hunter-Orionnoir