Extracting Transaction IDs from App Receipts

Hello everyone,

I'm currently in the process of updating my code to remove the deprecated verifyReceipt method in line with the latest documentation and guidelines.

I have a question regarding the Receipt Usage example provided in the documentation here: https://github.com/apple/app-store-server-library-java?tab=readme-ov-file#receipt-usage

ReceiptUtility receiptUtil = new ReceiptUtility();
String transactionId = receiptUtil.extractTransactionIdFromAppReceipt(appReceipt);

My question is: Why does this method only return one transactionId? I had assumed that it might return a list of different transaction IDs present in the encoded receipt.

Thank you in advance for any assistance!

Best regards,

Maria

  • Actually what I meant was originalTransactionId. Single originalTransactionId is returned but in the receipt there could be multiple ones.

Add a Comment

Replies

The method returns a single transactionId because that's all you need to transition off of verifyReceipt - a single valid transactionId for each of your users. Once you have this transactionId, you can then switch to calling the modern App Store Server API endpoints that accept a transactionId as an argument. See these core endpoints (which can be called via the App Store Server Library):

https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history

https://developer.apple.com/documentation/appstoreserverapi/get_all_subscription_statuses

For more information, see these WWDC sessions:

https://developer.apple.com/videos/play/wwdc2023/10141/?time=878

https://developer.apple.com/videos/play/wwdc2023/10143/