0

I'm accessing the receipt after a successful in-app subscription (by checking SKPaymentTransactionStatePurchased state). After I verified this receipt, in the receipt verification response "expiration_date", "expiration_date_ms", and "expiration_date_pst" are are missing under "receipt". Why is that?

(As a workaround I tried to get the last object of latest_receipt_info and refer its expiration date. But this data is referring to the last subscription before the current one. So I cannot find the required expiration date there.)

How can I resolve this and retrieve the expiration date of the subscription purchased just now?

Kulakshi
  • 11
  • 1
  • 5

2 Answers2

2

you're looking in the right place. You are probably looking at the wrong object in your index when you say the "last" one. It is a good practise to sort the latest_receipt_info, usually by purchase_date_* in order to make sure you can count on the object you're looking at.

Hitch22
  • 365
  • 1
  • 9
0

You should probably check this guide to see if there's something about the receipt structure you are getting wrong:

https://www.namiml.com/blog/app-store-verify-receipt-definitive-guide

In particular, in the receipt section you get an array of IAP items, each of which holds things like expiration_date.

latest_receipt_info should have the current subscription, and not the older one - are you processing the response from Apple's json, or just decoding the local receipt? A query with to Apple should always return the latest purchase data.

Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150