apple / app-store-server-library-java

MIT License
153 stars 39 forks source link

ReceiptUtility.extractTransactionIdFromAppReceipt question #115

Closed Krafton-HyunYun closed 2 months ago

Krafton-HyunYun commented 3 months ago

Hello folks. Hope you have a great day.

I'm trying to apply storekit library from traditional old http call. I got trouble restoring purchased products from client.

Client uploads with receipt(multiple transactions) which contains one NON_CONSUMABLE and multiple CONSUMABLE ITEMS.

I cannot get CONSUMABLE transaction id by ReceiptUtility.extractTransactionIdFromAppReceipt(non consumable is the first transaction on receipt)

I would like validation check (transaction id or ids contains in receipt) or extract all transaction ids from receipt.

Could you help me this this case? If I misunderstood on your function, please let me know. Thank you.

alexanderjordanbaker commented 3 months ago

@Krafton-HyunYun Hello, as seen in the README, once you have one of the transaction ids, you can then call the Get Transaction History endpoint to get all of the user’s transactions.

Krafton-HyunYun commented 3 months ago

@alexanderjordanbaker Thanks for your lightning fast reply :) I'll try Get Transaction History I misunderstood the API.

Krafton-HyunYun commented 2 months ago

@alexanderjordanbaker Get Transaction History works wonderfully! Thank you so much!!

I got a one more follow up question on http request count side. If I have a receipt which has 5 multiple transactions in it.

Could you share why you guys recommend Get Transaction History instead of extract all transaction id? Is it optimized by apple server? or Most of users covered by 1 Get Transaction History call?

Thank you.

alexanderjordanbaker commented 2 months ago

@Krafton-HyunYun So app receipts always have all of the user's transactions. So the number of transactions you will find in the app receipt vs Get Transaction History will be equivalent. However, once you know a user, you can always store the revision from a previous request and just use that to get new transactions for a user, instead of having to page through the entire history each time.

Krafton-HyunYun commented 2 months ago

@alexanderjordanbaker Thanks for detailed description on your app receipt and Get Transaction History.

Once again thank you and have a great day :)