I'm developing an app with auto-renewing receipts, and saving them in the server, which is all working great, until the user restores their purchases - this causes duplicates.
The transaction_id
field is different for the same receipt with every restore, and the original_transaction_id
is obviously the same across every run of renewals, so I can't use that.
The unique_identifier
field is also the same (I don't understand how it's unique).
I had been using the web_order_line_item_id
field and it seemed fine, but I just tested this with a completely new account, and ended up with a duplicate, so that's useless too.
I am missing something really obviously here? There must be a field that is unique to every receipt, but doesn't change each time it is restored?
Apparently original_transaction_id
and purchase_date
are the only two unique values that will not change after restoring purchases. You can also rely on latest_receipt_info -> web_order_line_item_id
as it doesn’t change between restores (unlike latest_receipt_info -> transaction_id
). By inspecting latest_receipt_info
you can find out expiration_date
of the subscription, which apparently apple believes should be enough for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With