Apple in-app purchase transaction_id of one purchase sometimes changes

As soon as I receive a receipt from the client and check it on the apple server, I received the transaction ID of the new purchase (this is an automatic subscription purchase) in this receipt. A few days later I receive a new receipt from the same customer and check it, strange things happen: the transaction ID of this old purchase changes.

I compare the data of this purchase in the old receipt with the data in the new receipt, only the transaction_id, original_transaction_id, purchase_date, expires_date, web_order_line_item_id and other fields change . similar.

Than I check the database, I found that about 1% of transaction records have the same situation. And there is a feature. Most of their transaction identifiers have been increased or decreased by 1-2 .

I used to think that a transaction ID is a purchase ID. Does anyone face the same problem or know the reason?

+5
source share
1 answer

Yes, we see it. We see that this is caused by clicking the "Restore purchase" button.

If your Restore Purchase button uses the restoreCompletedTransactions API, this will change the transaction ID. We confirmed this with support from Apple developers.

Apparently, you can call SKReceiptRefreshRequest instead to get the most recent receipt, rather than repeating all transactions. As far as I understand, this will not lead to a change in transaction identifiers.

Oddly enough, we have testified that the values ​​of web_order_line_item_id do not change when switching to restoreCompletedTransactions . However, we only received an ambiguous response, at best, from Apple support, when we asked for confirmation:

As for the web_order_line_item_id field, the value will change with each subsequent update.

You can use this if you continue to store the new value when renewal subscription events appear.

This means that web_order_line_item_id is unique when purchasing an update. Which neither confirms nor denies that it remains constant in all calls to restoreCompletedTransactions

In addition, I found that this conference entry on the Apple / Google / Amazon recurring billing is very useful (although not for this particular case):

Rosa Gutierrez is a recurring nightmare. Implement cross-platform in-app subscription

+3
source

Source: https://habr.com/ru/post/1264375/


All Articles