Open mepc36 opened 9 months ago
Looks like the package you're purchasing needs to be passed at a property inside an options object like so:
await Purchases.purchasePackage({ aPackage: offeringPackage });
As one more note:
this code/thread will be particularly helpful for anyone migrating from @awesome-cordova-plugins/purchases
to this package. This new package is mainly a drop-in replacement, with the following changes:
Purchases.configureWith
, but instead call Purchases.configure
.purchasePackage
problem detailed above.Purchases.setDebugLogs
, but Purchases.setLogLevel({ level: LOG_LEVEL.DEBUG })
instead.customerInfo
is now nested inside a larger returned object, so instead of this... const customerInfo = await Purchases.getCustomerInfo()
...call this:
const { customerInfo } = await Purchases.getCustomerInfo()
If I run into any other problems, I will report back. Thanks!
Leaving open for visibility, maintainers, feel free to close if you don't think a meaningful subset of your users will want this!
@mepc36 Hi! I had a question about the migration.
I am using this code on a NextJS project: import { Purchases } from "@revenuecat/purchases-capacitor"
await Purchases.configure({ apiKey, appUserID: uid })
But getting this error: Error: "CapacitorPurchases" plugin is not implemented on android
Do you maybe have any idea why it is not using Purchases instead of CapacitorPurchases?
When using: import { CapacitorPurchases } from '@capgo/capacitor-purchases';
CapacitorPurchases.setDebugLogsEnabled({ enabled: true }).then()
The app crashes instrantly, what would be a correct and functioning code solution at this moment?
@mepc36 thanks for sharing! Sorry for the delayed response, not sure how we missed this. @codykerns @tonidero we should have a section of the docs dedicated to this specific migration, I think @mepc36 is right and it'll be a common use case.
@Martijn0405 I'd recommend performing a clean install:
npm install @revenuecat/purchases-capacitor
ionic cap sync
and then ionic cap run android
Oh sorry we missed this! We have this doc with the changes in the API: https://github.com/RevenueCat/purchases-capacitor/blob/main/migrations/v6-MIGRATION.md, but we can add a link to that in the docs. Also, I think we might be able to explain a bit more about the changes in the doc
One question @mepc36, about this point:
customerInfo is now nested inside a larger returned object, so instead of this...
const customerInfo = await Purchases.getCustomerInfo()
...call this:
const { customerInfo } = await Purchases.getCustomerInfo()
If I run into any other problems, I will report back. Thanks!
This seems like it didn't change from version 5.x of the plugin. Did you update from an older version of the plugin?
Edit: Sorry, please ignore the above, you did mention you're coming from @awesome-cordova-plugins
. As Andy said, we are planning to create a guide to migrate from that to this plugin. Sorry for the noise!
Hi, how do I solve an error message that says "Missing identifier parameter in {}"?
Here is how I'm initializing purchases in a hook:
This is how I get and set the purchases' offerings and customer Info:
Here is the code that runs when the "Purchase Package" button is clicked:
Here is what the offeringPackage log in the above code prints:
What am I doing wrong?
Thanks for the plugin!