0

I have to implement Google In App susbscription in my app. In server side, I want to validate subscription status of user. The response of subscription is as follow

{
  "kind": "androidpublisher#subscriptionPurchase",
  "startTimeMillis": long,
  "expiryTimeMillis": long,
  "autoRenewing": boolean,
  "priceCurrencyCode": string,
  "priceAmountMicros": long,
  "countryCode": string,
  "developerPayload": string,
  "paymentState": integer,
  "cancelReason": integer,
  "userCancellationTimeMillis": long,
  "orderId": string
}

Google has api to validate subscription status. Its response is as follow.

{
  "kind": "androidpublisher#subscriptionPurchase",
  "startTimeMillis": long,
  "expiryTimeMillis": long,
  "autoRenewing": boolean,
  "priceCurrencyCode": string,
  "priceAmountMicros": long,
  "countryCode": string,
  "developerPayload": string,
  "paymentState": integer,
  "cancelReason": integer,
  "userCancellationTimeMillis": long,
  "orderId": string
}

I want to check user subscription status by using this API. The question I want to ask how will I know that user subscription has been renewed by this response. If user get subscription for one month and after one month, subscription will be renewed automatically. I have receipt for old subscription in my database and I will be using same OrderId to check subscription status. How will I new that subscription has been renewed for that particular orderId.

Muhammad Hassan
  • 14,086
  • 7
  • 32
  • 54

1 Answers1

0

Old question but still You can get no of renewals by orderId's no after two dots.

Take a look at the randoms answer

Order id for all recurrences are returned in orderId field of the INAPP_PURCHASE_DATA JSON field (in V3) with each recurring transaction appended by an integer.

Subscription order numbers

To help you track transactions relating to a given subscription, Google payments provides a base Merchant Order Number for all recurrences of the subscription and denotes each recurring transaction by appending an integer as follows:

GPA.1234-5678-9012-34567 (base order number)

GPA.1234-5678-9012-34567..0 (first recurrence orderID)

GPA.1234-5678-9012-34567..1 (second recurrence orderID)

GPA.1234-5678-9012-34567..2 (third recurrence orderID) ...

Community
  • 1
  • 1
Kishan Vaishnav
  • 2,273
  • 1
  • 17
  • 45