Reputation: 2606
Currently our system works in such a way that when a user buys an in-app subscription, the receipt data for the purchase is sent through to the server, and after validation we'll change the user's entitlements dependently.
Sometimes due to various reason we might have an issue where the user might not have been assigned the entitlements they were meant to, in which case they email us with the receipt they got from Apple, containing their Order ID and Document # etc.
I can't seem to find anything in the receipt data sent through with the in app purchase that matches anything in the document sent by apple, that'll allow me to figure out which order matches that order id.
Is there a way to get the Order ID etc from the in app purchase payload that'll help identify this?
Upvotes: 4
Views: 4120
Reputation: 48526
Since WWDC2021, the Lookup Order ID was added to App Store Server API, it could get a customer’s in-app purchases from a receipt using the order ID.
GET https://api.storekit.itunes.apple.com/inApps/v1/lookup/{orderId}
You could find the corresponding transactionId
from this API response JWSTransactionDecodedPayload
Here is one reference to implement the Lookup Order ID request https://github.com/richzw/appstore#look-up-order-id
Upvotes: 3
Reputation: 1004
No, the order IDs sent through receipts that Apple mails to users and the transactions IDs in App Store receipts are unrelated. (Not very useful, I know.)
If you indeed have the receipt on your backend, I would check the contents using the verifyReceipt endpoint and see what purchases they have. As long as your IAP's are non-consumable they will show up in the receipt. You can then hopefully grant them the entitlements manually. (IMO, from a customer service perspective I would just give the customer the benefit of the doubt and grant it right away.)
As an implementation note, you should never call finishTransaction
on a receipt until the user receives the expected entitlements from your backend. This leaves the transaction in the StoreKit queue and provides an easy mechanism for retrying later if a post to your backend fails.
Upvotes: 6