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=)]) ])

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

LastTransactionsItem length is always one
 
 
Q