Solved

iOS Subscription not going through despite successful Purchase! Why?

  • 8 November 2021
  • 1 reply
  • 358 views

Badge +6

The following is the console log after running a Purchase!

 

[Purchases] - DEBUG: ℹ️ makePurchase
[Purchases] - DEBUG: 💰 Purchasing product from package  - 20_Annual in Offering Default
[Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: 20_Annual 1000000905494521 ((null)) 1000000900724181 - 1
8.8.0 - [Firebase/Analytics][I-ACS023141] Purchase is a duplicate and will not be reported. Product ID: 20_Annual
[Purchases] - DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/394FDF88-2AA3-4C58-A311-3F9B84500545/StoreKit/sandboxReceipt
[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: tu7gcKSaiUN7GmjYdbOSa94pPKs2
[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 20_Annual 1000000905494521 (1000000900724181)

// My debug statement below
flutter: Purchase Level : 0 // This should be either 1 / 2 or 3

 

The following code makes the purchase:

 

PurchaserInfo purchaserInfo =await Purchases.purchasePackage(    myProductList[index]);purchaserInfo.activeSubscriptions.forEach((element) {print('** $element **');}); // Nothing gets printed hereProvider.of<CP>(context,listen: false).subsLevel = 0;if (purchaserInfo.entitlements.all['10 People'] != null &&    purchaserInfo.entitlements.all['10 People']!.isActive == true)  Provider.of<CP>(context,listen: false).subsLevel = 1;if (purchaserInfo.entitlements.all['20 People'] != null &&    purchaserInfo.entitlements.all['20 People']!.isActive == true)  Provider.of<CP>(context,listen: false).subsLevel = 2;if (purchaserInfo.entitlements.all['50 People'] != null &&    purchaserInfo.entitlements.all['50 People']!.isActive == true)  Provider.of<CP>(context,listen: false).subsLevel = 3;Navigator.pop(context, Provider.of<CP>(context,listen: false).subsLevel);

 

What am I doing wrong please?

icon

Best answer by DEE 10 November 2021, 00:24

View original

1 reply

Badge +6

Found the answer, I did not have that test account in Sandbox environment in App Store connect. Once I created the account with the correct email, it worked.

Reply