Frandro
Frandro

Reputation: 103

iOS IAP in_app field in receipt

There's an in_app field as an array in a receipt.

When does it return an array containing more than 1 element?

And what's the index of the latest purchased item?

Upvotes: 0

Views: 954

Answers (1)

Paulw11
Paulw11

Reputation: 114826

From the documentation

in_app:

In the JSON file, the value of this key is an array containing all in-app purchase receipts based on the in-app purchase transactions present in the input base-64 receipt-data. For receipts containing auto-renewable subscriptions, check the value of the latest_receipt_info key to get the status of the most recent renewal.

The in-app purchase receipt for a non-consumable product, auto-renewable subscription, non-renewing subscription, or free subscription remains in the receipt indefinitely.

So, if you have auto-renewing subscriptions or the user purchases multiple non-consumable or non-renewing subscription items you can expect this array to grow over time.

For auto-renewing subscriptions, the details of the most recent renewal is in the latest_receipt_info key.

Although it isn't documented, from observation it seems that the last item in the array is the most recent purchase, but you should check the purchase_date field to be sure.

Upvotes: 1

Related Questions