Solved

Unable to re-purchase a subscription in sandbox.

  • 27 October 2021
  • 6 replies
  • 193 views

Badge +3

I am testing purchasing my subscriptions in sandbox. My device has purchased a subscription before, and it has expired.

When I go in to purchase again, `Purchases.shared.purchasePackage` returns immediately with the `purchaserInfo` and the default entitlement shows my previous purchase, with an isActive status of false. I was never presented with the purchase modal.

 

When I `restoreTransactions`, the `purcahserInfo` shows the same, an expired entitlement. Why can’t I re-purchase an expired subscription?

icon

Best answer by ryan 29 December 2021, 00:56

View original

6 replies

Userlevel 5
Badge +9

Hmmm, do you see any errors or warnings in the debug logs or anything you could attach here? I’ve never had trouble re-purchasing an expired product. 

Badge +3

I didn’t see any errors or warnings in the debug log, it said “finishing transaction” just as if I had completed the purchase flow. I cannot reproduce at the moment because I went ahead and deleted my user in order to move forward with what I'm working on….

 

Badge +3

@ryan this has happened again. I try to re-purchase a subscription which I let expire, the `purchase` function’s completion block returns right away (without showing the payment sheet), and the entitlement’s `isActive` is false.

 

Here is the debug log, I x’d out my product id for privacy:

 

Purchases] - DEBUG: ℹ️ makePurchase

[Purchases] - DEBUG: 💰 Purchasing product from package  - xxx.xxxx.xxxxx.xxxxxxxx.xxxx.xxx.xx in Offering Annual Only

[Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: xxx.xxxx.xxxxx.xxxxxxxx.xxxx.xxx.xx 1000000900513404 ((null)) 1000000900301520 - 1

[Purchases] - DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/DADDDEC8-8C75-4D83-A1F4-8CB8C24FE39B/StoreKit/sandboxReceipt

[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: xxxxxxxxxxxx

 [Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request POST /receipts

[Purchases] - DEBUG: ℹ️ API request started: POST /v1/receipts

[Purchases] - DEBUG: ℹ️ API request completed with status: POST /v1/receipts 200

[Purchases] - DEBUG: ℹ️ Serial request done: POST /receipts, 0 requests left in the queue

Purchases] - DEBUG: 💰 Finishing transaction xxx.xxxx.xxxxx.xxxxxxxx.xxxx.xxx.xx 1000000900513404 (1000000900301520)

[Purchases] - DEBUG: ℹ️ PaymentQueue removedTransaction: xxx.xxxx.xxxxx.xxxxxxxx.xxxx.xxx.xx 1000000900513404 (1000000900301520 (null)) (null) - 1

Badge +3

I did some debugging myself by setting breakpoints in the RevenueCat code.

I set a breakpoint at:

- (void)paymentQueue:(SKPaymentQueue *)queue

updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions

 

line 102 in RCStoreKitWrapper, and when the breakpoint hit, the payment sheet showed. Could it possibly be some sort of race condition where the breakpoint helped?

I have the exact same issue with my iOS RN app (using "react-native-purchases": "4.4.1"). It simply doesn’t show the payment confirmation dialog for one particular subscription (monthly). For another one (annual) it does.

Nothing in the logs or anywhere. 

Given that it’s my first experience with RevenueCat, I’m wondering if the users in prod aren’t going to have the same issue, so it’s pretty disturbing.

Thank you!

Userlevel 5
Badge +9

Hey @Vladyslav!

A good debugging step here could be to try creating a new sandbox account in App Store Connect and make sure you’re testing on a physical device - not a simulator. Apples doesn’t give developers (including RevenueCat) any control over when/how the payment sheet or confirmation dialog appears so these types of issues are often related to the underlying Apple account or device. 

Reply