Question

Unable to re purchase subscription in sandbox environment of IOS.

  • 23 March 2022
  • 6 replies
  • 171 views

Badge +4

I am testing purchases in sandbox. I have purchased a subscription before, and it has expired.

When I go in to purchase again, `Purchases.purchasePackage` prints purchase successful immediately  and returns nothing and stalls.


6 replies

Badge +4

@tina do you see any reason why this is happening ?

 

 

Userlevel 3
Badge +7

Hi @Programiz , 


Happy to help here! Is this issue still occurring?

If so can you please send over some debug logs? 

You can enable debug logs by following this guide. After they're enabled you'll see logs like this in the console:
 

[Purchases] - DEBUG: No cached entitlements, fetching
[Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID> 200
[Purchases] - DEBUG: Purchaser info updated, sending to delegate


Please ensure the debug logs include the entire app life-cycle, including the messages printed during initialization of the SDK. The more information you include here, the better we'll be able to help.

 

Let me know if you have any questions!

I have the same issue. For my monthly package, Purchases.purchasePackage() does not open iOS purchase modal in sandbox and instantly returns. Works fine with Annually.

It’s the same piece of code with different products from getOfferings. 

If it failed instead of returning successfully, it would be great we could just handle the failure.

Maybe the reason is why is because after fifth renewal it is opt-out. it is handled by Apple connect.Here it is explained more broadly: https://stackoverflow.com/a/12027860

Badge +2

This is still an ongoing issue for us, using RevenueCat SDK 4.0.0 in Unity 2021.3.8. After a few repurchases, it becomes impossible to repurchase that subscription product on iOS.

 

Those purchases are in sandbox. But it is impossible for us to determine if this is a sandbox-only issue. We never had a similar issue with in our current implementation of Unity IAP, so anwsering this is actually an important issue for us as we are currently trying to assess if the SDK is stable enough to launch with. 

 

PurchaseProduct conclude with no errors, but the CustomerInfo does not include any active Entitlement or any ActiveSubscription.

 

Here is a sample of the logs from one of those failed purchase:

2022-09-01 12:06:22.334218-0400 AppName[18946:594262] [Purchases] - DEBUG: ℹ️ Skipping products request because products were already cached. products: ["com.company.app.subscription_one_month_01"]
2022-09-01 12:06:22.337390-0400 AppName[18946:593336] [Purchases] - INFO: 💰 Purchasing Product 'com.company.app.subscription_one_month_01'
2022-09-01 12:06:22.340405-0400 AppName[18946:593336] [Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: com.company.app.subscription_one_month_01 XXXXXXXXXXXXXXX1 XXXXXXXXXXXXXXX2 1
2022-09-01 12:06:22.341816-0400 AppName[18946:593336] [Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.

2022-09-01 12:06:23.055246-0400 AppName[18946:594262] [Purchases] - DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/StoreKit/sandboxReceipt
2022-09-01 12:06:23.055986-0400 AppName[18946:594262] [Purchases] - DEBUG: ℹ️ Skipping products request because products were already cached. products: ["com.company.app.subscription_one_month_01"]
2022-09-01 12:06:23.056637-0400 AppName[18946:593336] [Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: XXXXXXXXXXXXXXXX
2022-09-01 12:06:23.088693-0400 AppName[18946:594262] [Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Started
2022-09-01 12:06:23.089212-0400 AppName[18946:594262] [Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request POST receipts
2022-09-01 12:06:23.097133-0400 AppName[18946:594262] [Purchases] - DEBUG: ℹ️ API request started: POST /v1/receipts
2022-09-01 12:06:25.050778-0400 AppName[18946:594262] [Purchases] - DEBUG: ℹ️ API request completed: POST /v1/receipts 200
2022-09-01 12:06:25.066365-0400 AppName[18946:594262] [Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Finished
2022-09-01 12:06:25.066750-0400 AppName[18946:594262] [Purchases] - DEBUG: ℹ️ Serial request done: POST receipts, 0 requests left in the queue
2022-09-01 12:06:25.071697-0400 AppName[18946:593336] [Purchases] - INFO: 😻💰 Purchased product - 'com.company.app.subscription_one_month_01'
2022-09-01 12:06:25.073391-0400 AppName[18946:593336] [Purchases] - INFO: 💰 Finishing transaction com.company.app.subscription_one_month_01 XXXXXXXXXXXXXXX1 (XXXXXXXXXXXXXXX2)

 

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