1

I have an auto-renewable subscription. Also I have the following code for purchasing:

SKProduct* productToPurchase = #create product logic#;
SKPayment* payment = [SKPayment paymentWithProduct:productToPurchase];
[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];
[[SKPaymentQueue defaultQueue] addPayment:payment];

So, the purchasing of an original subscription is ok. After that I close my app and wait offline until at least one of auto-renewal period happens. I launch my app, and my expectation is I'll receive a callback about new transaction here:

- (void)paymentQueue:(SKPaymentQueue*)queue updatedTransactions:(NSArray*)transactions

But nothing happens. I don't receive anything about that offline auto-renewal. Note, that also I add observer asap:

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)options {
...
[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];
...
}

So, what can be wrong here? Or are there more correct ways to understand if the subscription was prolonged?

Thanks a lot! Serge

  • ok, yes, I tried to do that: `auto refreshRequest = [[SKReceiptRefreshRequest alloc] initWithReceiptProperties:nil]; [refreshRequest setDelegate:observer]; [refreshRequest start];` but it requires user to enter a password for his apple ID every app launching, that's bad – Serge Manjukhin Mar 10 '17 at 12:57
  • 1
    also, their docs tell us: _After a subscription is successfully renewed, Store Kit adds a transaction for the renewal to the transaction queue. Your app checks the transaction queue on launch and handles the renewal the same way as any other transaction. Note that if your app is already running when the subscription renews, the transaction observer is not called; your app finds out about the renewal the next time it’s launched._ – Serge Manjukhin Mar 10 '17 at 13:02
  • in my testing, the renewal payment was delivered to the payment queue when I launched the app after the renewal time. If you explicitly refresh the receipt then the user gets prompted for a login, but the receipt is refreshed automatically, so you can just access the receipt and will contain the renewed subscription. – Paulw11 Mar 12 '17 at 23:58

1 Answers1

0

I've been experiencing the same issue and after playing around a bit, it seems like it randomly works sometimes in the sandbox. I also found a blog where the developer also has the same issue but he claims that it works around 1 in 3 times for him in the sandbox.

So I guess it's just one more quirk of the sandbox you/we have to deal with.

Mof
  • 363
  • 3
  • 9