zns-iap0.7.4 • Public • Published
In-app purchase verification
fork from node-iap
npm install zns-iap
Only a single method is exposed to verify purchase receipts:
var iap = ;var platform = 'apple';var payment =receipt: 'receipt data' // always requiredproductId: 'abc'packageName: 'my.app'secret: 'password'subscription: true // optional, if google play subscriptiondevToken: 'developer id' // required, if roku;iap;
The receipt you pass must conform to the requirements of the backend you are verifying with. Read the next chapter for more information on the format.
The payment object
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).
Both productId and packageName (bundle ID) are optional, but when provided will be tested against. If the receipt does not match the provided values, an error will be returned.
To verify auto-renewable subscriptions you need to provide
secret field that
contains your In-App Purchase Shared Secret
The response passed back to your callback will also be Apple specific. The entire parsed receipt
will be in the result object. Applications that support monthly and yearly
subscription access will represent auto-renewable terms in either the
The payment object
The receipt string is the purchase token that Google Play returns to the mobile application when a purchase is made.
Both packageName and productId are compulsory.
Lastly you must provide
keyObject which is the Google API Service Account JSON key file linked to your Google Play
account for authentication. This property can be either a string, file buffer or an object. If provided a string or file
buffer, the call will automatically parse it into an object for use.
The response passed back to your callback will also be Google Play specific. The entire parsed response will be in the receipt sub-object.
The receiept string represents the transaction returned from a channel or product purchase.
A developer ID is required.
The response passed back to your callback will also be Roku specific. The entire parsed receipt will be in the result object:
Regardless of the platform used, besides the platform-specific receipt, the following properties will be included:
- transactionId, to uniquely identify this transaction.
- productId, which specifies what was purchased.
- platform, which is always the platform you passed.
Google Play References