Solved

Unable to re-purchase a subscription in sandbox.

  • 27 October 2021
  • 10 replies
  • 467 views

Badge +4

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

10 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 +4

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 +4

@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 +4

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. 

Badge

hei, 

I am getting the exact same issue with Flutter SDK and iOS real device. Sometimes (not always, which is really the worst part) when I try to repurchase the call simply goes through without throwing any exception and without bringing the native subscription dialog to allow the user to purchase. This happens with the monthly subscription and the yearly subscription works as expected (Exactly as Vladyslav above states). I am not testing the yearly subscription enough as it takes more time so perhaps that could be the reason.

This is quite disturbing as I definitely do not want to see this in production. I have been using qOnversion until now and I thought I should switch but now I am quite conflicted about it. Any help is greatly appreciated.

Here is the flutter code:

final purchaserInfo = await Purchases.purchasePackage(package_monthly!);

And here is the purchaserInfo object that is returned but again, no exception is thrown and no purchase native dialog is show to the user:

flutter: PurchaserInfo(entitlements: EntitlementInfos(all: {premium: EntitlementInfo(identifier: premium, isActive: false, willRenew: false, latestPurchaseDate: 2022-05-27T11:48:03Z, originalPurchaseDate: 2021-07-30T06:01:32Z, productIdentifier: monthly_light, isSandbox: true, ownershipType: OwnershipType.purchased, store: Store.appStore, periodType: PeriodType.normal, expirationDate: 2022-05-27T11:53:03Z, unsubscribeDetectedAt: 2022-05-27T13:48:05Z, billingIssueDetectedAt: null)}, active: {}), allPurchaseDates: {monthly_light: 2022-05-27T11:48:03Z}, activeSubscriptions: [], allPurchasedProductIdentifiers: [monthly_light], nonSubscriptionTransactions: [], firstSeen: 2022-05-27T13:47:58Z, originalAppUserId: $RCAnonymousID:d4bc9b9838994c749e04da9986254524, allExpirationDates: {monthly_light: 2022-05-27T11:53:03Z}, requestDate: 2022-05-27T15:28:20Z, latestExpirationDate: 2022-05-27T11:53:03Z, originalPurchaseDate: 2013-08-01T07:00:00Z, originalApplicationVersion: 1.0, managementURL: null)

 

Btw, I also can not find the originalAppUserId in the sandbox dashboard (from the purchaserInfo object above)

Hey,

I was also experiencing same issue on iPhone with flutter. Yesterday it was working fine but now i am having issue repurchasing product.

 

When i try to repurchase same subscription with purchasePackage function it returns below package without showing In app purchase dialog box.

 

EntitlementInfo{identifier: Premium, isActive: false, willRenew: false, periodType: PeriodType.normal, latestPurchaseDate: 2022-06-10T07:04:54Z, originalPurchaseDate: 2022-05-24T10:34:49Z, expirationDate: 2022-06-10T07:07:54Z, store: Store.appStore, productIdentifier: vc_599_1m_1m0, isSandbox: true, unsubscribeDetectedAt: 2022-06-10T07:16:33Z, billingIssueDetectedAt: null, ownershipType: OwnershipType.purchased}

 

This problem only occur when i try to repurchase same subscription if i choose different plan then everything working as expected.

 

I am thinking maybe it is some sort of caching issue. Any help would be appreciated as this is blocking our app roll out.

I’d like to bump this thread as I’m running into the exact same issue in versions `5.0.0-beta.4` and `5.0.2`. on a physical iOS device. The issue is exactly as described above. I have a sandbox account that has purchased a monthly subscription which has since expired. When calling `Purchases.purchasePackage` the checkout screen is never presented and the promise is resolved with an empty `activeSubscriptions` and `entitlements.active` on the `customerInfo` object.

Userlevel 4
Badge +8

We’ve had a few reports of this and it seems to be an issue with StoreKit 1. Upgrading to using an SDK version that allows you to use StoreKit 2 under the hood should help. 

The latest version of our iOS, Flutter, React-Native and Unity SDKs support StoreKit 2, by passing an extra parameter when configuring. 

 

Could you give it a shot? Let me know if you need instructions for any particular SDK. 

Reply