When to send IAP receipt for validation with own server?

When to send IAP receipt for validation with own server?
0
#1

Hi, i using sdkbox iap v2.4.3.3 with Cocos2d-JS.

I try to use my own server validation but wonder when should i send the IAP receipt.
Is it proper to send it on “onSuccess” callback because it will has some delay?

When i use sdkbox::IAP::enableUserSideVerification(false);, it doesnt has delay after the Apple IAP success popup and sdkbox stated it will verify the receipt with own server.

But as part of the above issue, when “onSuccess” is not triggered, is there any way i can get the IAP receipt manually so i can send for validation and complete the IAP?

sdkbox.IAP.setListener({
    onSuccess : function (product) {
        //Purchase success
        "send receipt to server for validation and complete the IAP"
    },
    onFailure : function (product, msg) {
        //Purchase failed
        //msg is the error message
    },
    onCanceled : function (product) {
        //Purchase was canceled by user
    },
    onRestored : function (product) {
        //Purchase restored
    },
    onProductRequestSuccess : function (products) {
        //Returns you the data for all the iap products
        //You can get each item using following method
        for (var i = 0; i < products.length; i++) {
            // loop
        }
    },
    onProductRequestFailure : function (msg) {
        //When product refresh request fails.
    }
});

In the guide http://docs.sdkbox.com/en/plugins/iap/v3-js/

the Handling Purchase Events only include above events in the listener, but i saw more events below.

I test on sdkbox.IAP.getPurchaseHistory(); but get error message “getPurchaseHistory is invalid on iOS”, is there any similar function on iOS?

onInitialized(success);

onRestoreComplete(ok, msg);

onShouldAddStorePayment(productName);

onFetchStorePromotionOrder(productNames, error);

onFetchStorePromotionVisibility(productName, visibility, error);

onUpdateStorePromotionOrder(error);

onUpdateStorePromotionVisibility(error);

onPurchaseHistory(purchases);

onConsumed(p, error);

onDeferred(p);

Thank you!

0 Likes