question

Ozan Yilmaz avatar image
Ozan Yilmaz asked

Play Store receipt validation and cancellation

Hello everyone,

The questions are a bit unrelated to PlayFab, but I'm new to IAP, and I'm trying to make an automatic system to handle some situations.

The game will be released on Play Store.

- Do subscription receipts change when they are renewed?

When a user's subscription renews itself, does the receipt ID change (a new receipt is created) or does the ID stay same but the information on the receipt changes (e.g expiration date)? I think, to be able to renew a subscription, I need to validate a receipt again by calling ValidateGooglePlayPurchase API. If the receipt ID stays same, does PlayFab accept the same receipt ID?

- How can I save the expiration dates on PlayFab?

I guess, when a receipt is validated on PlayFab, player_receipt_validation event is called. If I setup a rule on PlayFab, can I get the receipt's expiration date or the receipt's time span on Cloudscript? If I can get the time span, it will be easy for me to handle the expiration dates. (current server time + time span). If I can get the expiration date, is the date in UTC? If the date isn't in UTC, how can I convert it to UTC?

- Should I take back the subscription features immediately when a user cancels their subscription?

I don't know the behavior of Play Store in terms of cancellations. Does the subscription is canceled immediately when a user cancels their subscription? For example; if a user purchases a monthly subscription and use it for 1 week and cancel it, is the full price of the subscription reducted from the developer's payment or does the subscription stay until its expiration date and doesn't renew itself when it's expired? If the former happens, I should take back the subscription features immediately. If the latter happens, I don't need any extra action to do something since I already save the expiration dates on the players' read only data. (To be able to save the expiration dates, I need to make a system in the second question)

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

>> - Do subscription receipts change when they are renewed?

According to this doc from google: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en, I don’t see it mentioning that auto-renewals will change its id, however, to make sure that’s the case please contact the google play team regarding this.

>> - How can I save the expiration dates on PlayFab?

All the related info regarding the receipt will be included in the “ReceiptContent”property:

ReceiptContent: The receipt data during a real money purchase event attempt.

Google play uses expiryTimeMillis (Time at which the subscription will expire, in milliseconds since the Epoch.) to represent the expiry time, you’d need to use that to convert to UTC. For instance, in JS:

const date = new Date(1612765894818);

//"Mon, 08 Feb 2021 06:31:34 GMT"

console.log(date.toUTCString());

>>- Should I take back the subscription features immediately when a user cancels their subscription?

When the user cancels its subscription, the subscription remains valid until its expiration time, please check out this doc:https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/cancel?hl=en. And, for more details regarding google play services, please contact their support team for more professional help.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ozan Yilmaz avatar image Ozan Yilmaz commented ·

Thank you so much for the answer. These details were driving me crazy about IAP.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.