react-native-purchases icon indicating copy to clipboard operation
react-native-purchases copied to clipboard

Initialize RevenueCat STORE for both iOS & Android in a single Screen

Open anisurrahman072 opened this issue 2 years ago • 5 comments

Suggesting a way to --> Initialize RevenueCat STORE for both iOS & Android in a single Screen

If you are controlling both Android and iOS paywall screen from a single screen, then initialize RevenueCat STORE like below just before calling product purchase API instead of calling the initialize SDK inside useEffect().

image

It was not very clear in the documentation that how it could be done very fast.

anisurrahman072 avatar Jan 19 '24 10:01 anisurrahman072

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Jan 19 '24 10:01 RCGitBot

and how to handle slow test card , Approves after some time case as it goes in the error block

const productToBuy = {
       identifier: selectedPlan.identifier,
       description: selectedPlan.description,
       title: selectedPlan.title,
       price: selectedPlan.price,
       priceString: selectedPlan.priceString,
       currencyCode: selectedPlan.currencyCode,
       introPrice: selectedPlan.introPrice,
       discounts: selectedPlan.discounts,
       productCategory: selectedPlan.productCategory,
       subscriptionPeriod: selectedPlan.subscriptionPeriod,
       defaultOption: selectedPlan.defaultOption || null,
       subscriptionOptions: selectedPlan.subscriptionOptions || null,
       presentedOfferingIdentifier: selectedPlan.presentedOfferingIdentifier || null,
     };
     const { customerInfo, productIdentifier } = await Purchases.purchaseStoreProduct(
       productToBuy
     );
   ****Goes in the error block and gives if slow test card [Error: Payment is Pending]****
     Alert.alert('Success', 'Plan Purchased successfully');
     navigation.goBack();
```}

mangal-brovitech avatar Jan 23 '24 17:01 mangal-brovitech

Hey @anisurrahman072 !

Thanks for the feedback, I have noted this and we will work on updating the documentation to make this clearer.

michaelAtRC avatar Jan 23 '24 17:01 michaelAtRC

@michaelAtRC can you help me if you how to handle slow test card scenario for google console sandbox environment ?

mangal-brovitech avatar Jan 23 '24 17:01 mangal-brovitech

Hey @mangal-brovitech ,

That is usually a case of the sandbox user having a long history of purchases. I recommend testing with a fresh sandbox user and testing this function again.

Let me know if that helps!

michaelAtRC avatar Jan 26 '24 22:01 michaelAtRC