Whats the correct API to use to fetch Inapp transaction history

Hello, We have INAPP purchase feature in our APP and we are storing the ORIGINAL TRANSACTION ID using the verifyReceipt API at the time of purchase to one of our tables.

Now we have to take this ORIGINAL TRANSACTION ID and call APPSTORE backend API to get the purchase history for this original transaction ID. To get this accomplished we found these two apis(but unsure if they are active/deprecated) -

https://api.appstoreconnect.apple.com

**https://api.storekit-sandbox.itunes.apple.com/inApps/v1/subscriptions/%7BoriginalTransactionId%7D%E2%80%9D **

The first API is working after we generated a TOKEN using KEY_ID + ISSUER_ID and a PRIVATE KEY we downloaded from our account under "App Store Connect Api"

we can get the below calls to work https://api.appstoreconnect.apple.com/v1/users https://api.appstoreconnect.apple.com/v1/devices

But using the same JWT token when we call the second api https://api.storekit-sandbox.itunes.apple.com/inApps/v1/subscriptions/%7BoriginalTransactionId%7D%E2%80%9D

we are getting { "errorCode": 4000002, "errorMessage": "Invalid request app identifier."

  1. Did anyone tried to call the APPSTORE CONNECT or APPLE STOREKIT backend API to get transaction history given the ORIGINAL TRANSACTION ID ?

Note: Attached the PYTHON code we run to generate the JWT token.

You are missing the BID field as specified in https://developer.apple.com/documentation/appstoreserverapi/generating_tokens_for_api_requests. The second API is the one you are looking for, however, to get the current subscription status. https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history will have the full user's history

Hello, This is good information. We are testing as per your recmmendation and will revert back quickly.

Hello, it worked and I am getting many SignedtransactION - TOKEN LIKE values back. But i was expecting a JSON response with all HUMAN readable KEY VALUE pairs. Is there another API that I have to call after calling the bwlow API ?

https://api.storekit-sandbox.itunes.apple.com/inApps/v1/history/2000000281000188

RESPONSE: { "revision": "1676915803000_2000000281985893", "bundleId": "com.uturngreen", "environment": "Sandbox", "hasMore": true, "signedTransactions": [ "eyJhbGciOiJFUzI1NiIsIng1YyI6WyJNSUlFTURDQ0E3YWdBd0lCQWdJUWFQb1BsZHZwU29FSDBsQnJqRFB2OWpBS0JnZ3Foa2pPUFFRREF6QjFNVVF3UWdZRFZRUURERHRCY0hCc1pTQlhiM0pzWkhkcFpHVWdSR1YyWld4dmNHVnlJRkpsYkdGMGFXOXVjeUJEWlhKMGFXWnBZMk ........ MANY VALUES and i UNDERSTAND this is RENEWAL INFORMATION.

Since its SANDBOX the renewal is done by default and many entries are generated.

BUT WHAT WE NEED is the JSON RESPONSE. PLEASE GUIDE us where to get it?

Thanks! Jana

Hello, Upon further digging the documentation it seems like we have to DECODE the JWS signed transactions - https://developer.apple.com/documentation/appstoreserverapi/jwstransaction

I was able to now use the signed transaction and decode and see the JSON values - thanks a lot!

Whats the correct API to use to fetch Inapp transaction history
 
 
Q