j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.29k stars 529 forks source link

getOffer returns nothing on iOS #1505

Open dimitriscsd opened 5 months ago

dimitriscsd commented 5 months ago

For some reason, product.getOffer gives me nothing on iOS, while on Android it works perfectly.

const offer = product.getOffer(product.id); ^ this worked only on Android

After many hours of trying to figure out what's going on, I tried product.offers[0] instead of .getOffer() and that seems to work just fine.

const offer = product.offers[0]; ^ this worked on both iOS and Android

Thought I'd report it.

If it means anything, the ids of my products are integer numbers of string value. For example "222345"

flyingbarista commented 5 months ago

I'm also having this issue, the same - only with iOs. Thanks for posting your solution it would have done my head in.

AlexandrDegteari commented 5 months ago

updated to version 13.10, for me doesn't work even product.offers[0] on IOS anyone found solution?

flyingbarista commented 5 months ago

What its working for me is define product1 as a global variable, then call that in your store function. Also for some reason I had a problem with the shortcuts, just to rule it out try longhand with CdvPurchase.product.offers[0]

var product1;

then in your store UI refresh function product1 = CdvPurchase.store.get('product1_T2', CdvPurchase.Platform.APPLE_APPSTORE);

in the order button function product1.offers[0].order();