LastTransactionsItem length is always one

Hello, I am a backend developer who is developing a payment server.

When the app store server notification is received, I would like to update the current regular payment status using the

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

However, whenever you call the API, only one LastTransactionsItem comes. It is currently being tested in a sandbox environment.

Why is there always one LastTransactionsItem?

If so, should I find the group that matches the originalTransactionId and update it to the status of the LastTransactionsItem[0]?

Below is my response. If anyone knows a little about this, please help me.

SubscriptionStatusResponse(environment=Sandbox, appAppleId=null, bundleId=co.hihihihi.example, data=[ SubscriptionGroupIdentifierItem(subscriptionGroupIdentifier=20879849, lastTransactions=[LastTransactionsItem(originalTransactionId=1000000955193630, status=EXPIRED, signedTransactionInfo=, signedRenewalInfo=)]), SubscriptionGroupIdentifierItem(subscriptionGroupIdentifier=20952548, lastTransactions=[LastTransactionsItem(originalTransactionId=2000000050601533, status=EXPIRED, signedTransactionInfo=, signedRenewalInfo=)]) ]) SubscriptionStatusResponse(environment=Sandbox, appAppleId=null, bundleId=co.riiid.StoreKitCatalog, data=[ SubscriptionGroupIdentifierItem(subscriptionGroupIdentifier=20879849, lastTransactions=[LastTransactionsItem(originalTransactionId=1000000955193630, status=ACTIVE, signedTransactionInfo=, signedRenewalInfo=)]), SubscriptionGroupIdentifierItem(subscriptionGroupIdentifier=20952548, lastTransactions=[LastTransactionsItem(originalTransactionId=2000000050601533, status=EXPIRED, signedTransactionInfo=, signedRenewalInfo=)]) ])

Replies

Question: Are you noting that when you receive a server notification that you in turn want to check back with the App Store to get status? If so, I'd suggest to use the data provided in the server notification itself. But if you are using version 1 notifications, if you update to version 2 then you will effectively combine them so the notification provides only the transaction/status that applies to the notification itself.

The get all subscription statuses endpoint provides the current status for the customer and your app. So that will include status for each subscription group.

May be worthwhile to check out the WWDC21 session to for more info: https://developer.apple.com/videos/play/wwdc2021/10174

  • Hello, I am currently using version 2 notification.

    Nevertheless, the reason why I want to do check back with the App Store to get status is as follows.

    It does not pass the current status to notification itself. I can guess the status through eventType & subType, but I thought it should be updated through the API because the exact status is given through API.The server failed to receive Notification, so it was determined that the order of notification may not be guaranteed through retry, etc. So, I tried to call the API because I thought that getting the latest status from the server and updating it would keep it in the right state.

    Please give me your advice on this. Thank you.

Add a Comment