Skip to main content
Solved

Encountering error "Parameter specified as non-null is null" when attempting purchase


Forum|alt.badge.img+2

I’m trying to integrate in-app purchases into my React Native app. Everything is configured correctly on RevenueCat and the app stores, and I’m able to fetch and display my offerings using `Purchases.getOfferings()`. However, when I try to execute `Purchases.purchasePackage()`, I encounter the following error:

“Parameter specified as non-null is null: method com.revenuecat.purchases.hybridcommon.CommonKt.purchasePackage, parameter packageIdentifier”

A similar error occurs when I try to execute `Purchases.purchaseStoreProduct()`. The error suggests that I’m passing `null` as a parameter, but I’m definitely passing the correct identifier as a string.

Thanks in advance to anyone who can help me resolve this :)

Best answer by mugen-dynamics-0245a2

This was happening to us, because we used to pass the Product.identifier to the Purchases.purchaseProduct(identifier), where as the new library requires the entire Product object to be passed as an argument. 

 

await Purchases.purchaseStoreProduct(product);

--

return <Button

key={pkg.product.identifier}

style={styles.button}

disabled={processing}

onPress={() => makeInAppPurchase(pkg.product)}

>

View original
Did this post help you find an answer to your question?

2 replies

Forum|alt.badge.img+3

This was happening to us, because we used to pass the Product.identifier to the Purchases.purchaseProduct(identifier), where as the new library requires the entire Product object to be passed as an argument. 

 

await Purchases.purchaseStoreProduct(product);

--

return <Button

key={pkg.product.identifier}

style={styles.button}

disabled={processing}

onPress={() => makeInAppPurchase(pkg.product)}

>


MarcosC
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • 167 replies
  • June 20, 2023

Hi @mugen-dynamics-0245a2 

I was checking RN docs and there are a few purchases alternatives:

Your update looks good to me :D and let me know if this helps 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings