question

Ozan Yilmaz avatar image
Ozan Yilmaz asked

How to get expiryTimeMillis of receipt?

Hello everyone,

I asked a question about expiration dates of Play Store subscriptions, and I got an answer saying that expiration date is included in ReceiptContent property. I tested the subscription feature in my game but I couldn't find expiryTimeMillis in the property.

https://community.playfab.com/questions/49619/play-store-receipt-validation-and-cancellation.html

I basically setup a rule that runs when a receipt is validated (player_receipt_validation). When it's called, I try to access the expiryTimeMillis variable in ReceiptContent property, but the variable is undefined.

Here's the code:

    var content = JSON.parse(context.playStreamEvent.ReceiptContent);
    log.info("expiryTimeMillis: " + content["expiryTimeMillis"]);

Here's the receipt content and the log:

// Receipt Content

"ReceiptContent": "{\"orderId\":\"GPA.xxxx-xxxx-xxxx-xxxxx\",\"packageName\":\"com.xxxxx.xxxxx\",\"productId\":\"item.badge.bronze\",\"purchaseTime\":1613218400006,\"purchaseState\":0,\"purchaseToken\":\"mhcecpofacjkgcadfemmjbfo.AO-J1OxRMggdQTkIDx1yukOqTSq54xZPrFZ_10iUhOOrz8BfmfHJZJEG7-yx7bOF5ODwuagPpi4DPThv16oQ4NOg6uB24l88o6L2zAMqYO4I9-fjAYuu4Qo\",\"autoRenewing\":true,\"acknowledged\":false}",

// Log

"expiryTimeMillis: undefined"
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

According to the content of the receipt, looks like "expiryTimeMillis" is not included. As per the document from Google, purchases.subscriptions.get will check whether a user's subscription purchase is valid and returns its expiry time: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get?hl=en

2 comments
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 ·

Can I get that data, expiry time, on the server-side? Is there any way to do it?

If I get that data from a client, the context might be modified.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Ozan Yilmaz commented ·

I believe the API Ref link I posted above is the Developer API, which is used on the server-side.

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.