cordova-plugin-purchase
cordova-plugin-purchase copied to clipboard
Can't define product into consumable
Any ideas what am I doing wrong here:
Expected behavior
The product can be purchased multiple times
Observed behavior
The procuct is non consumable. It can be bought only once. After that the store throws an error that I already own the product.
window.CdvPurchase.store.register([
{
id: 'testi',
type: window.CdvPurchase.ProductType.CONSUMABLE,
platform: window.CdvPurchase.Platform.GOOGLE_PLAY
},
]);
window.CdvPurchase.store.initialize([
window.CdvPurchase.Platform.GOOGLE_PLAY
]);
window.CdvPurchase.store.when()
.approved(transaction => {
alert("CdvPurchase approved transaction: " + JSON.stringify(transaction))
//purchaseReceipt.value = transaction
transaction.verify()
})
.verified(receipt => {
alert("verified receipt: " + JSON.stringify(receipt))
purchaseReceipt.value = receipt
// finish transactions from verified receipts
receipt. Finish();
});
....
function appStoreOrder(offer){
console.log('appStoreOrder of ', offer)
window.CdvPurchase.store.order(offer)
}
the output of store.products:
[
{
"className": "Product",
"title": "testaan (fi.****.**** (unreviewed))",
"description": "testing",
"platform": "android-playstore",
"type": "consumable",
"id": "testi",
"group": "default",
"offers":
[
{
"className": "Offer",
"id": "testi",
"pricingPhases":
[
{
"price": "8,50 €",
"priceMicros": 8500000,
"currency": "EUR",
"recurrenceMode": "NON_RECURRING"
}
],
"productId": "testi",
"productType": "consumable",
"productGroup": "default",
"platform": "android-playstore",
"type": "inapp"
}
]
} ]
`
Thanks for the help!
Late reply but: If you don't consume a CONSUMABLE, the store won't let you buy it again. Does your verification work and is .verified()
ever called? If not, the transaction remains unfinished.