Open RintuMondal06 opened 6 months ago
Have you initialized the store?
CdvPurchase.store.initialize();
Have you initialized the store?
CdvPurchase.store.initialize();
@undergroundcreative yes, i called CdvPurchase.store.initialize()
before calling CdvPurchase.store.register()
!
Ok you need to register products and set callbacks before calling CdvPurchase.store.initialize()
See here for an example: https://purchase.cordova.fovea.cc/discover/micro-example
Ok you need to register products and set callbacks before calling CdvPurchase.store.initialize()
See here for an example: https://purchase.cordova.fovea.cc/discover/micro-example
@undergroundcreative thanks for your help! I'm following the example from the doc but in my case store.get()
is returning undefined
while fetching the product.
Below is my code:
const product = CdvPurchase.store.get(
PRODUCT_ID,
CdvPurchase.Platform.GOOGLE_PLAY
);
product.getOffer()
.order()
.then((p) => {
console.log('order then block', p);
})
.catch((e) => {
console.log('error order in catch', e);
});
That part of the code looks right to me. Maybe you should post your full code (obviously blank out sensitive info like product ids etc)
The second part, I use:
store.order(product.getOffer()).then(e => {...});
This is the full code for the in-app-purchase.
// Consumable product register
CdvPurchase.store.register({
id: currentValue,
type: CdvPurchase.ProductType.CONSUMABLE,
platform:CdvPurchase.Platform.GOOGLE_PLAY,
});
// event listeners
CdvPurchase.store.when(my_product_code)
.approved((transaction) =>transaction.verify())
.verified((receipt) => receipt.finish())
.finished((p) => {
// custom function called here to update the server
});
// order code block
const product = CdvPurchase.store.get(
PRODUCT_ID,
CdvPurchase.Platform.GOOGLE_PLAY
);
product.getOffer()
.order()
.then((p) => {
console.log('order then block', p);
})
.catch((e) => {
console.log('error order in catch', e);
});
There's no sign of CdvPurchase.store.initialize(); in that code :)
What is your output now?
const product = CdvPurchase.store.get(
'my_product_id',
CdvPurchase.Platform.GOOGLE_PLAY
);
CdvPurchase.store
.order(product.getOffer())
.then((p: any) => {
console.log('order then block', p);
})
.catch((e: any) => {
console.log('error order in catch', e);
});
product
is undefined, that is my issue right now.
same problem I have, someone found solution?
I have the same issues on my side.
The function is returning undefined and some fields are missing in CdvPurchase.Product
.
product.canPurchase = true;
product.title = "";
product.description = "";
product.offers[0].id = "$";
product.offers[0].productId = "qcm3ans";
But this is not the case for all products (one has all information)
@j3k0 @RintuMondal06 I am facing same issue on iOS. Not tried for Android. Any solution for the same?
If the product is undefined it could mean it isn't available for purchase. Your code needs to check if store.get(...)
returns undefined and warn the user that the product isn't available at the moment.
Notice also that if done properly, the user shouldn't be able to call order for that product, since you're supposed to display the price and title as returned by the plugin. So if a product is not available the "buy" button should be grayed out or replaced by a warning that "this offer isn't available at the moment".
This is a use case that needs to be handled gracefully, as some users have in-app purchases disabled on their device.
To understand the reason why the product isn't available, please share some logs.
@j3k0 store.get(...) returns undefined on iOS. Also I checked again on App Store Connect and I can see status of Non-Renewing Subscriptions is "Approved". Why still I am not getting product details? Till date it was working. When I have updated last time at that time I am getting this error.
Why still I am not getting product details?
Can you share debug logs?
@j3k0
For android my in app purchase is working well. Getting issue on iOS. Sending log soon. Is it due to below reason? Check screenshot.
Yes, any banking, tax and paid agreements warnings will results in in-app purchases being disabled for the developer account.
@j3k0 All of the agreement and other setup has been done related to Tax, banking, etc. All set but still getting product details undefined on iOS, for Android it's working well.
Also follow the example but still getting undefined. Status of product on apple store is approved. And it was working previously. https://purchase.cordova.fovea.cc/discover/micro-example
Any one has any idea?
@j3k0 It's working now.
So it was the missing tax form?
No it was one mistake in my code to validate platform.
One more question: store.when().verified(receipt => {
When I am checking receipt of testflight build on real device, I am not getting "receipt.sourceReceipt.transactions[0].nativePurchase".
Format of testflight build receipt has been changed?
@shahdeep1989 can you please help with Android implementation? I can't find any issues in my current code. If you share your code here for reference it would be a great help for me. Thanks!
Project Info
Output
Getting errors in order with error code
6777008
and the error message is"Adapter not found or not ready (undefined)"