Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

node-apple-receipt-verify

> 编程语言
Open source

A Node.js module for In-App-Purchase receipt validation for iOS.

99 stars0 likes3 views
WebsiteGitHub

About

A Node.js module for In-App-Purchase receipt validation for iOS.

node-apple-receipt-verify

A Node.js module for Apple In-App-Purchase receipt validation for iOS.

Note: Storekit Versions:

This works module with the (older) Storekit API, the newer Storekit 2 uses JWT tokens which can be verified without an API call to Apple

Changes

See CHANGELOG

Debug Logging

The module can optionally turn on verbose debug log.

In order to enable the verbose logging, give the following to .config():

javascript
var appleReceiptVerify = require('node-apple-receipt-verify');
appleReceiptVerify.config({
  verbose: true
});

Methods

.config(options [object])

Initializes module. Can be called more than once to reconfigure module.

options: supports following keys:

  • secret [string] [optional] - Apple shared secret (See it in iTunes Connect: Go to My Apps > (select your app) > In-App Purchases > View or generate a shared secret) [required]
  • verbose [boolean] [optional] - verbose logging switch, false by default. [optional]
  • environment [array of strings] [optional] - defines environments used for receipt validation on Apple servers. Supported environments: 'sandbox', 'production'. The sequence is important. Defaults to ['production'].
  • ignoreExpiredError [boolean] [optional] - if true, then does not return error if receipt is expired. Default is false.
  • ignoreExpired [boolean] [optional] - if true, then expired purchases are skipped. Defaults to true.
  • extended [boolean] [optional] - if true, then purchases contains extended information. Defaults to false. (since v1.1.1)
  • excludeOldTransactions [boolean] [optional] - If value is true, response includes only the latest renewal transaction for any subscriptions (Apple Documentation).
  • doNotRemoveNonSubscriptions [boolean] [optional] - If true, then lifetime purchases also will be returned.

.config()

Returns current global config.

.validate(options [object], callback [function (err, purchasedProducts [array of objects ])])

Validates an in-app-purchase receipt.

options: supports keys:

  • receipt [required] - base64 encoded receipt.
  • device [optional] - iOS vendor identifier. NOTE: [deprecated]

You can also add options passed to config(), they override default options.

callback [optional]: receives error or list of purchased products embedded in receipt.

The purchased products list has structure:

[
{
    bundleId: ,
    transactionId: ,
    productId: ,
    purchaseDate: ,
    quantity: ,
    *expirationDate: ,
    *isTrialPeriod: ,              // only for subscriptions and if extented = true
    *isInIntroOfferPeriod: ,       // only for subscriptions and if extented = true, since v1.5.1
    *environment: ,                 // only if extented = true
    *originalPurchaseDate: ,        // only if extented = true
    *applicationVersion: ,          // only if extented = true
    *originalApplicationVersion:    // only if extented = true
},
...
]

Usage

…

Errors

Errors can have additional optional properties:

  • isRetryable (bool) - true if Apple service recommends to retry request a bit more later.
  • appleStatus (number) - status returned by Apple validation service.

Special errors

EmptyError - returned in case of receipt without purchase
const appleReceiptVerify = require('node-apple-receipt-verify');
const EmptyError = appleReceiptVerify.EmptyError;
ServiceUnavailableError - returned when Apple validation service returned, e.g: 503, etc.

You can retry request later.

Author

  • Siarhei Ladzeika >

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言