Skip to content

Validate In-App Purchases (IAP) on App Store using fetch and es6/7

License

Notifications You must be signed in to change notification settings

sibelius/iap-receipt-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iap-receipt-validation - In-App Purchase Receipts validation on App Store

This package provides a simple function to validate IAP Receipts on App Store

installation

npm i --save iap-receipt-validator

usage

import iapReceiptValidator from 'iap-receipt-validator';

const password = 'b212549818ff42ecb65aa45c'; // Shared Secret from iTunes connect
const isProduction = false; // true = prod, false = sandbox
const validateReceipt = iapReceiptValidator(password, isProduction);

async validate(receiptData) {
    try {
        const validationData = await validateReceipt(receiptData);

        // check if Auto-Renewable Subscription is still valid
        // validationData['latest_receipt_info'][0].expires_date > today
    } catch(err) {
        console.log(err.valid, err.error, err.message)
    }
}

kickstarted by npm-boom

About

Validate In-App Purchases (IAP) on App Store using fetch and es6/7

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published