james.lorenzen
james.lorenzen

Reputation: 540

Safe to assume paymentState is absent from Google Play API for test purchases?

It appears when I get the Purchases.subscriptions resource for a purchaseToken using the Google Play Developer API that test purchases do not include the paymentState property. However, real purchases seem to always include it. So is it safe to assume that when a Purchases.subscriptions resource does not include the paymentState property that that purchaseToken was from a test purchase?

We are validating purchaseTokens and renewals server-side and are looking for a better solution for determining if a purchase was a test purchase or not without having to depend on the presence or absence of an orderId which is only available to the app.

Upvotes: 6

Views: 1275

Answers (3)

Gaurav Agrawal
Gaurav Agrawal

Reputation: 11

Not sure if it's relevant now but Purchases.subscriptions:get now includes a purchaseType in the response

purchaseType 0 means its a test purchase

Refer - https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions

Upvotes: 1

Dee Elle
Dee Elle

Reputation: 21

since July 10th 2017, Google Play now provides an orderID from test purchases.

Upvotes: 1

james.lorenzen
james.lorenzen

Reputation: 540

So I realized that using paymentState was not the correct way to detect a test purchase. I noticed that if a purchaseToken had a failed payment, the paymentState property was not returned either. So we finally just settled on using the absence or presence of the orderId passed to us from the app.

Upvotes: 0

Related Questions