Sandbox transactions: Missing and Multiple

Hello,


During testing of my IAP (Recuring Subscriptions) I see the following


1. I set a 1 month subscription and get regular transactions triggered from the device into the payment queue until they expire. Great, everything is as expect.

2. Then sometimes no transaction are added to the queue for future payments (again from the device).

3. Other times 100s of transactions are added to the queue all at once.


I suspect that number 2 and 3 are linked and for some reason they all get stuck on Apple's servers and then are released all together.


Does anyone else see this?

Is this normal?

I assume this doesn't happen in production?


Thanks,


David

Accepted Reply

What is normal is to get, one time only, 5 renewals for each test user who subscribes to an autorenewable subscription IAP. Once a particular test user has gotten their 5 renewals, each new subscription generates only one subscription - no renewals.

Replies

What is normal is to get, one time only, 5 renewals for each test user who subscribes to an autorenewable subscription IAP. Once a particular test user has gotten their 5 renewals, each new subscription generates only one subscription - no renewals.

It is possible to get old baggage transactions so to speak.


For example, if you are using the same test account, have created and removed more than one in-app product from the store during development, and maybe didn’t always complete the transactions you could keep seeing transactions from the past.


While it is best to just create new tester accounts, App Store Connect doesn’t reliably allow you to do so. If you can’t create new testers, send up a flare to App Store Connect they may be inclined to help you though you might want to clear your browser and possibly double check your banking info first.


While you wait, you can do the following:


In the func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) of your PaymentTransactionObserver as you loop over your transactions, first filter and finish any obsolete transactions. For example, you can check that the productIdentifier matches the current valid product that you want to process.


You may still find that obsolete transactions don’t actually go away after being finished. Oddly enough, I found it helped to implement the method:

func paymentQueue(_ queue: SKPaymentQueue, removedTransactions transactions: [SKPaymentTransaction])


I just print out the removedTransactions. They don’t always go away the first run, but may peter out in a few runs.