Closed selcukbeyhan closed 1 month ago
Generally your integration will include a receipt validation server (iaptic.com or your own). Calling "verify" will wait for confirmation that the receipt is legit (and store that purchase on the server) when confirmed the transaction can be finished. This is however optional and was omitted in the micro example.
After the validation at the remote server is done, where should we call the transaction.finish() then or is it not necessary?
In the verified callback,
store.when()
.approved(transaction => transaction.verify())
.verified(receipt => receipt.finish())
Thanks a lot.
Can you please help with the issue #1530 too?
I created this validator for simplicity but the interface contract seems is missing. let validator = (receipt:any, callback:any) => { callback({ ok: true, status: 'valid', data: { quantity: 1, transaction_id: receipt.transaction.id, purchase_date: receipt.transaction.purchaseDate, expiration_date: receipt.transaction.expirationDate, "is_canceled": false, "is_refunded": false, id: receipt.id, latest_receipt: true, transaction: {type: 'ios-appstore', data:null} } }); } CdvPurchase.store.validator = validator;
Thank you.
If that's all your validator does, you can skip the "verify" step and call finish right away.
I had actually developed that validator just to test the validator. It is not the final version.
Hi,
Observed behavior
In the Micro Example, there are these instructions: function onDeviceReady() { const {store, ProductType, Platform} = CdvPurchase; refreshUI(); store.register([{ type: ProductType.CONSUMABLE, id: 'my_product', platform: Platform.TEST, ]}); store.when() .productUpdated(refreshUI) .approved(finishPurchase); store.initialize([Platform.TEST]); }
function finishPurchase(transaction) { localStorage.goldCoins = (localStorage.goldCoins | 0) + 10; transaction.finish(); refreshUI(); }
These indicate to call the transaction.finish() function when the purchase is approved. However, in the SDK documentation, this is written different under the CdvPurchase.Transaction: /**
This indicates that transaction.verify() should be called when purchase is approved and not transaction.finish().
Which one is correct?
Thank you.