Question

Purchase package works, but completion block never fires?

  • 10 October 2023
  • 4 replies
  • 84 views

Badge

Hello. For the life of me, I cannot get the completion block to fire when making a purchase. Purchases all have gone through successfully but RevenueCat is not letting me know so that I can do post-transaction clean-up. 

[[RCPurchases sharedPurchases] purchasePackage:package withCompletion:^(RCStoreTransaction *transaction, RCCustomerInfo *customerInfo, NSError *error, BOOL cancelled) {

NSLog(@"SUBSCRIPTION PURCHASED");

 }];

Notes: 

  • Running iOS 17.0.1 (have tried 15 as well).
  • Testing in sandbox, multiple devices.
  • Have created new sandbox user(s), logged out of device, deleted app, restarted device, restarted Xcode, cleaned build folder. Several times.
  • Using Objective C. 
  • Completion block for getOfferings and restorePurchases does work properly.  

I know I’m new to RevenueCat, but everything else seems to be working fine, all except this all-important feature. Any assistance or insight on this would be greatly appreciated. Thanks!

 


4 replies

Badge +1

Hi, 

i have the exact same issue, 

the callback of purchase package is never called

   [[RCPurchases sharedPurchases] purchasePackage:offerings.current.annual withCompletion:^(RCStoreTransaction *transaction, RCCustomerInfo *customerInfo, NSError *error, BOOL cancelled) 
{

}

BUT, if I add this line before

   RCPurchases.sharedPurchases.finishTransactions = false;

the callback is called.

try on your side to check if we have the same issue.

Thanks

Badge

Yes, adding RCPurchases.sharedPurchases.finishTransactions = false; allows the completion block code to execute. (However, I really wanted RevenueCat to do all the lifting here, and I do not plan on setting up a server to handle finishing the transaction.) 

Looking forward to hearing if RC support has any insight into this...

Userlevel 4
Badge +8

Hi, while this isn't proper behavior, it's not uncommon to see weird behavior in the sandbox environment.  Can you provide me with a couple of things here so we can investigate this:

  • Can you let me know what language/version of our SDK you are using? 
  • Could you please send verbose debug logs for this? You can do this by changing it from RCLogLevelDebug to RCLogLevelVerbose.

Also, with this you won’t want to call  RCPurchases.sharedPurchases.finishTransactions = false as setting this value to false will prevent the SDK from finishing transactions and you would then need to finish transactions in your app yourself.

Badge +1

thanks for your message, I have found the issue, I had this line in my appdelegate

 

[[SKPaymentQueue defaultQueue] addTransactionObserver:[InAppRageIAPHelper sharedHelper]];

 

removing this line fixed the issue.

 

Reply