-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discrepancy between SDK Documentation and Micro Example #1596
Comments
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. 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:
/**
* Finish a transaction.
*
* When the application has delivered the product, it should finalizes the order.
* Only after that, money will be transferred to your account.
* This method ensures that no customers is charged for a product that couldn't be delivered.
*
* @example
* store.when()
* .approved(transaction => transaction.verify())
* .verified(receipt => receipt.finish())
/
finish(): Promise;
/*
* Verify a transaction.
*
* This will trigger a call to the receipt validation service for the attached receipt.
* Once the receipt has been verified, you can finish the transaction.
*
* @example
* store.when()
* .approved(transaction => transaction.verify())
* .verified(receipt => receipt.finish())
*/
verify(): Promise;
This indicates that transaction.verify() should be called when purchase is approved and not transaction.finish().
Which one is correct?
Thank you.
The text was updated successfully, but these errors were encountered: