Question

Puchase was succssful via react-native-purchases in Adroid, but there is no response in promise “await Purchases.purchasePackage(purchasePackage)”

  • 4 October 2022
  • 0 replies
  • 101 views

Badge +1

Puchase was succssful via react-native-purchases in Adroid, but there is no response in promise “await Purchases.purchasePackage(purchasePackage)”

Please kindly guide how to solve this problem. Thx!

Screenshot:

Code:

import Purchases from 'react-native-purchases';

const PackageItem = ({ purchasePackage, setIsPurchasing }) => {
const {
product: { title, description, priceString },
} = purchasePackage;

const navigation = useNavigation();

const onSelection = async () => {
setIsPurchasing(true);

try {
console.log(
'************* Before await Purchases.purchasePackage(purchasePackage) purchasePackage is :',
purchasePackage,
);
const { purchaserInfo } = await Purchases.purchasePackage(purchasePackage);

console.log(
'************* After await Purchases.purchasePackage(purchasePackage), purchaserInfo is :',
purchaserInfo,
);

if (typeof purchaserInfo.customerInfo.entitlements.active.my_entitlement_identifier !== 'undefined') {
console.log('************* User is PRO *************');
navigation.goBack();
}
} catch (e) {
console.log('Error in PackageItem index.js:', JSON.stringify(e));
if (!e.userCancelled) {
Alert.alert('Error purchasing package', e.message);
}
} finally {
setIsPurchasing(false);
}
};

 

Debug log:

2022-10-04 12:36:34.050 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  Retrieving customer info with policy: CACHED_OR_FETCHED
2022-10-04 12:36:34.060 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Vending CustomerInfo from cache.
2022-10-04 12:36:34.061 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Checking if cache is stale AppInBackground false
2022-10-04 12:36:34.080 zygote64                com...icweather.lataval.reactnative  I  Do full code cache collection, code=501KB, data=357KB
2022-10-04 12:36:34.081 zygote64                com...icweather.lataval.reactnative  I  After code cache collection, code=501KB, data=305KB
2022-10-04 12:36:34.230 ReactNativeJS           com...icweather.lataval.reactnative  I  ---------------- offerings.current enter PaywallScreen
2022-10-04 12:36:34.243 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Vending Offerings from cache
2022-10-04 12:36:34.244 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Checking if cache is stale AppInBackground false
2022-10-04 12:36:34.300 ReactNativeJS           com...icweather.lataval.reactnative  I  '**************** offerings.current is:', { twoMonth: null,
                                                                                          weekly: null,
                                                                                          monthly: 
                                                                                           { offeringIdentifier: 'Default',
                                                                                             product: 
                                                                                              { introPrice: null,
                                                                                                currencyCode: 'MXN',
                                                                                                priceString: 'MX$99.99',
                                                                                                productCategory: 'SUBSCRIPTION',
                                                                                                price: 99.99,
                                                                                                title: 'rc_6999_1m_2d0 (com.revenuecat.magicweather.lataval.reactnative (unreviewed))',
                                                                                                productType: 'AUTO_RENEWABLE_SUBSCRIPTION',
                                                                                                discounts: null,
                                                                                                description: '',
                                                                                                identifier: 'test_mw_vip_month_001' },
                                                                                             packageType: 'MONTHLY',
                                                                                             identifier: '$rc_monthly' },
                                                                                          sixMonth: null,
                                                                                          annual: 
                                                                                           { offeringIdentifier: 'Default',
                                                                                             product: 
                                                                                              { introPrice: null,
                                                                                                currencyCode: 'MXN',
                                                                                                priceString: 'MX$199.99',
                                                                                                productCategory: 'SUBSCRIPTION',
                                                                                                price: 199.99,
                                                                                                title: 'Yearly plan 199 with 1 week free (com.revenuecat.magicweather.lataval.reactnative (unreviewed))',
                                                                                                productType: 'AUTO_RENEWABLE_SUBSCRIPTION',
                                                                                                discounts: null,
                                                                                                description: '',
                                                                                                identifier: 'rc_19999_1y_1w0' },
                                                                                             packageType: 'ANNUAL',
                                                                                             identifier: '$rc_annual' },
                                                                                          lifetime: null,
                                                                                          threeMonth: null,
                                                                                          serverDescription: 'The standard set of features',
                                                                                          availablePackages: 
                                                                                           [ { offeringIdentifier: 'Default',
                                                                                               product: 
                                                                                                { introPrice: null,
                                                                                                  currencyCode: 'MXN',
                                                                                                  priceString: 'MX$199.99',
                                                                                                  productCategory: 'SUBSCRIPTION',
                                                                                                  price: 199.99,
                                                                                                  title: 'Yearly plan 199 with 1 week free (com.revenuecat.magicweather.lataval.reactnative (unreviewed))',
                                                                                                  productType: 'AUTO_RENEWABLE_SUBSCRIPTION',
                                                                                                  discounts: null,
                                                                                                  description: '',
                                                                                                  identifier: 'rc_19999_1y_1w0' },
                                                                                               packageType: 'ANNUAL',
                                                                                               identifier: '$rc_annual' },
                                                                                             { offeringIdentifier: 'Default',
                                                                                               product: 
                                                                                                { introPrice: null,
                                                                                                  currencyCode: 'MXN',
                                                                                                  priceString: 'MX$99.99',
                                                                                                  productCategory: 'SUBSCRIPTION',
                                                                                                  price: 99.99,
                                                                                                  title: 'rc_6999_1m_2d0 (com.revenuecat.magicweather.lataval.reactnative (unreviewed))',
                                                                                                  productType: 'AUTO_RENEWABLE_SUBSCRIPTION',
                                                                                                  discounts: null,
                                                                                                  description: '',
                                                                                                  identifier: 'test_mw_vip_month_001' },
                                                                                               packageType: 'MONTHLY',
                                                                                               identifier: '$rc_monthly' } ],
                                                                                          identifier: 'Default' }
2022-10-04 12:36:34.516 zygote64                com...icweather.lataval.reactnative  I  Do partial code cache collection, code=502KB, data=317KB
2022-10-04 12:36:34.518 zygote64                com...icweather.lataval.reactnative  I  After code cache collection, code=502KB, data=317KB
2022-10-04 12:36:34.518 zygote64                com...icweather.lataval.reactnative  I  Increasing code cache capacity to 2MB
2022-10-04 12:36:38.447 ReactNativeJS           com...icweather.lataval.reactnative  I  '************* Before await Purchases.purchasePackage(purchasePackage) purchasePackage is :', { offeringIdentifier: 'Default',
                                                                                          product: 
                                                                                           { introPrice: null,
                                                                                             currencyCode: 'MXN',
                                                                                             priceString: 'MX$199.99',
                                                                                             productCategory: 'SUBSCRIPTION',
                                                                                             price: 199.99,
                                                                                             title: 'Yearly plan 199 with 1 week free (com.revenuecat.magicweather.lataval.reactnative (unreviewed))',
                                                                                             productType: 'AUTO_RENEWABLE_SUBSCRIPTION',
                                                                                             discounts: null,
                                                                                             description: '',
                                                                                             identifier: 'rc_19999_1y_1w0' },
                                                                                          packageType: 'ANNUAL',
                                                                                          identifier: '$rc_annual' }
2022-10-04 12:36:38.528 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Vending Offerings from cache
2022-10-04 12:36:38.529 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Checking if cache is stale AppInBackground false
2022-10-04 12:36:38.530 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  💰 Purchase started - product:  StoreProduct(sku=rc_19999_1y_1w0, type=SUBS, price=MX$199.99, priceAmountMicros=199990000, priceCurrencyCode=MXN, originalPrice=MX$199.99, originalPriceAmountMicros=199990000, title=Yearly plan 199 with 1 week free (com.revenuecat.magicweather.lataval.reactnative (unreviewed)), description=, subscriptionPeriod=P1M, freeTrialPeriod=null, introductoryPrice=null, introductoryPriceAmountMicros=0, introductoryPricePeriod=null, introductoryPriceCycles=0, iconUrl=, originalJson={"productId":"rc_19999_1y_1w0","type":"subs","title":"Yearly plan 199 with 1 week free (com.revenuecat.magicweather.lataval.reactnative (unreviewed))","name":"Yearly plan 199 with 1 week free","price":"MX$199.99","price_amount_micros":199990000,"price_currency_code":"MXN","subscriptionPeriod":"P1M","skuDetailsToken":"AEuhp4IAdfj-zgqgUEQuaEanDGupevnCDRk9y5lWLbtUF4-hUF57XVm0WJiD2MbZXnvJMLv8Of8wNDuXOAkSky1pfjz1YPsKNV41oNWWHw=="})  - offering: Default
2022-10-04 12:36:38.530 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  💰 Purchasing product: rc_19999_1y_1w0
2022-10-04 12:36:38.585 ActivityTrigger         pid-1729                             E  activityStartTrigger: not whiteListedcom.revenuecat.magicweather.lataval.reactnative/com.android.billingclient.api.ProxyBillingActivity/4003
2022-10-04 12:36:38.586 ActivityTrigger         pid-1729                             E  activityResumeTrigger: not whiteListedcom.revenuecat.magicweather.lataval.reactnative/com.android.billingclient.api.ProxyBillingActivity/4003
2022-10-04 12:36:38.604 ActivityTrigger         pid-1729                             E  activityResumeTrigger: not whiteListedcom.revenuecat.magicweather.lataval.reactnative/com.android.billingclient.api.ProxyBillingActivity/4003
2022-10-04 12:36:38.656 PhoneWindow             com...icweather.lataval.reactnative  D  DEBUG_ALIENSCREEN:getRotation mRotation=0
2022-10-04 12:36:38.659 DecorView               com...icweather.lataval.reactnative  I  setWindowBackground mBackgroundPadding = Rect(0, 0 - 0, 0), mFramePadding = Rect(0, 0 - 0, 0), pkg = com.revenuecat.magicweather.lataval.reactnative
2022-10-04 12:36:38.733 TouchMotionHandler      com...icweather.lataval.reactnative  I  handler onAttached
2022-10-04 12:36:42.268 ViewRootIm...nActivity] com...icweather.lataval.reactnative  D  onDisplayChange oldDisplayState=2 newDisplayState=1
2022-10-04 12:36:42.274 ViewRootIm...gActivity] com...icweather.lataval.reactnative  D  onDisplayChange oldDisplayState=2 newDisplayState=1
2022-10-04 12:36:42.328 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ App backgrounded
2022-10-04 12:36:42.329 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ No subscriber attributes to synchronize.
2022-10-04 12:36:43.629 ViewRootIm...nActivity] com...icweather.lataval.reactnative  D  onDisplayChange oldDisplayState=1 newDisplayState=2
2022-10-04 12:36:43.630 ViewRootIm...gActivity] com...icweather.lataval.reactnative  D  onDisplayChange oldDisplayState=1 newDisplayState=2
2022-10-04 12:36:43.949 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ App foregrounded
2022-10-04 12:36:43.949 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Checking if cache is stale AppInBackground false
2022-10-04 12:36:43.950 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Checking if cache is stale AppInBackground false
2022-10-04 12:36:43.951 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Updating pending purchase queue
2022-10-04 12:36:43.953 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Querying purchases
2022-10-04 12:36:43.954 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ No subscriber attributes to synchronize.
2022-10-04 12:36:43.985 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Cleaning previously sent tokens
2022-10-04 12:36:43.986 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Tokens already posted: []
2022-10-04 12:36:43.986 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Saving tokens []
2022-10-04 12:36:43.988 [Purchases] - DEBUG     com...icweather.lataval.reactnative  D  ℹ️ Tokens already posted: []


0 replies

Be the first to reply!

Reply