j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.3k stars 537 forks source link

IOS In-app purchase giving store type as io-appstore and id only, #236

Closed Alphatiger closed 7 years ago

Alphatiger commented 9 years ago

IOS In-app purchase giving store type as io-appstore and id only, how to validate this and get the receipt information

fabiosussetto commented 9 years ago

On iOS you need to set up a validator callback (store.validator = function (product, callback) {...}, check the docs) . product.transaction in you validator callback contains the full receipt data.

ozexpert commented 9 years ago

https://github.com/Wizcorp/node-iap requires to send receipt which is described below

The receipt string passed may be either the base64 string that Apple really wants, or the decoded receipt as returned by the iOS SDK (in which case it will be automatically base64 serialized).

however, i get only the type as ios-appstore and transaction id. where can i find the receipt?

ozexpert commented 9 years ago

Ah... i solved it.

You need to use

store.validator = function(product, callback) {
    console.log(angular.toJson(product));
};

store.when("product").approved(function(product) {
    product.verify();
});

Try adding code like above. you'll get product.transaction.appStoreReceipt object, which can be used in node-iap plugin. any questions, feel free to ask me.