Open Bandito11 opened 6 years ago
Same thing here, But.... I receive a purchasedState :0, if the purchased was effective... Any other case : no connection, item no purchase, etc..., I get a success but with an empty array...
Really? How weird...
@Bandito11 - any luck in getting date of purchase on Android? Works well for me on iOS.
I never did :(
Esteban Morales
From: Sylwester notifications@github.com Sent: Tuesday, July 24, 2018 4:26:05 PM To: AlexDisler/cordova-plugin-inapppurchase Cc: Esteban Morales; Mention Subject: Re: [AlexDisler/cordova-plugin-inapppurchase] When running the method InAppPurchase.restorePurchase() I get a value of undefined on Android from the state and date properties. (#222)
@Bandito11https://github.com/Bandito11 - any luck in getting date of purchase on Android? Works well for me on iOS.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/AlexDisler/cordova-plugin-inapppurchase/issues/222#issuecomment-407540393, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJWmySL6DN7JN7Rga8TVgPnIFs6kmJulks5uJ4LdgaJpZM4StLgS.
until PR is accepted you need to edit platforms/android/platform_www/plugins/cordova-plugin-inapppurchase/www/index-android.js
change state and date to what i below. Hope it helps
inAppPurchase.restorePurchases = function () { return nativeCall('init', []).then(function () { return nativeCall('restorePurchases', []); }).then(function (purchases) { var arr = []; if (purchases) { arr = purchases.map(function (val) { return { productId: val.productId, state: val.purchaseState, date: val.purchaseTime, transactionId: val.orderId, type: val.type, productType: val.type, signature: val.signature, receipt: val.receipt }; }); } return Promise.resolve(arr); }); };
I'm using cordova-plugin-inapppurchase 1.2.0 and when I tried restoring purchases on Android, state
and date
were both undefined
. The solution given by @sylwester- (changing state: val.state
to state: val.purchaseState
and date: val.date
to date: val.purchaseTime
) worked.
Please include:
Your code / steps to reproduce
Console output
undefined
but no errors.
Type of product you are working with consumable/non-consumable/subscription
non-consumable
Version of cordova
cordova 8.0
Version of iOS/Android
Android 7.1