Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-apple-receipt-verify

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-apple-receipt-verify - npm Package Compare versions

Comparing version 1.12.1 to 1.13.0

4

CHANGELOG.md
# CHANGELOG
## 1.13.0
### Fixed
* https://github.com/ladeiko/node-apple-receipt-verify/issues/43
## 1.12.1

@@ -4,0 +8,0 @@ ### Fixed

@@ -411,2 +411,3 @@ 'use strict';

data[index].originalApplicationVersion = purchase.receipt.original_application_version;
data[index].appAccountToken = purchase.receipt.app_account_token || item.app_account_token;

@@ -459,2 +460,3 @@ if (typeof item.cancellation_date_ms === 'string' || typeof item.cancellation_date === 'string') {

r.originalApplicationVersion = item.original_application_version || '1.0';
r.appAccountToken = item.app_account_token;

@@ -461,0 +463,0 @@ if (typeof item.cancellation_date === 'string') {

4

package.json
{
"name": "node-apple-receipt-verify",
"description": "A Node.js module for Apple In-App-Purchase receipt validation for iOS",
"version": "1.12.1",
"version": "1.13.0",
"homepage": "https://github.com/ladeiko/node-apple-receipt-verify",

@@ -66,3 +66,3 @@ "repository": {

},
"readme": "# node-apple-receipt-verify\n\nA Node.js module for Apple In-App-Purchase receipt validation for iOS.\n\n### Changes\n\nSee [CHANGELOG](CHANGELOG.md)\n\n### Debug Logging\n\nThe module can optionally turn on verbose debug log.\n\nIn order to enable the verbose logging, give the following to `.config()`:\n\n```javascript\nvar appleReceiptVerify = require('node-apple-receipt-verify');\nappleReceiptVerify.config({\n verbose: true\n});\n```\n\n### Methods\n\n#### .config(options [object])\n\nInitializes module. Can be called more than once to reconfigure module.\n\n**options**: supports following keys:\n- `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]\n- `verbose` \\[boolean\\] \\[optional\\] - verbose logging switch, `false` by default. [optional]\n- `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']`.\n- `ignoreExpiredError` \\[boolean\\] \\[optional\\] - if true, then does not return error if receipt is expired. Default is false.\n- `ignoreExpired` \\[boolean\\] \\[optional\\] - if `true`, then expired purchases are skipped. Defaults to `true`.\n- `extended` \\[boolean\\] \\[optional\\] - if `true`, then purchases contains extended information. Defaults to `false`. (since v1.1.1)\n- `excludeOldTransactions` \\[boolean\\] \\[optional\\] - If value is true, response includes only the latest renewal transaction for any subscriptions ([Apple Documentation](https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW3)).\n\n#### .config()\n\nReturns current global config.\n\n#### .validate(options [object], callback [function (err, purchasedProducts [array of objects ])])\n\nValidates an in-app-purchase receipt.\n\n**options**: supports keys:\n- `receipt` \\[required\\] - base64 encoded receipt.\n- `device` \\[optional\\] - iOS vendor identifier. NOTE: [deprecated]\n\nYou can also add options passed to ```config()```, they override default options.\n\n**callback** \\[optional\\]: receives error or list of purchased products embedded in receipt.\n\nThe purchased products list has structure:\n\n```\n[\n{\n bundleId: <string>,\n transactionId: <string>,\n productId: <string>,\n purchaseDate: <number>,\n quantity: <number>,\n *expirationDate: <number>,\n *isTrialPeriod: <boolean>, // only for subscriptions and if extented = true\n *isInIntroOfferPeriod: <boolean>, // only for subscriptions and if extented = true, since v1.5.1\n *environment: <string>, // only if extented = true\n *originalPurchaseDate: <number>, // only if extented = true\n *applicationVersion: <string>, // only if extented = true\n *originalApplicationVersion: <string> // only if extented = true\n},\n...\n]\n```\n\n### Usage\n\n```javascript\nconst appleReceiptVerify = require('node-apple-receipt-verify');\n\n// Common initialization, later you can pass options for every request in options\nappleReceiptVerify.config({\n secret: \"1234567890abcdef1234567890abcdef\",\n environment: ['sandbox']\n});\n\n// Callback version\nappleReceiptVerify.validate({\n receipt: appleReceipt,\n device: '438498A7-4850-41DB-BCBE-4E1756378E39'\n }, (err, products) => {\n if (err) {\n return console.error(err);\n }\n // ok!\n});\n\n// Callback version without device\nappleReceiptVerify.validate({\n receipt: appleReceipt\n }, (err, products) => {\n if (err) {\n return console.error(err);\n }\n // ok!\n});\n\n// Promise version\ntry {\n \n const products = await appleReceiptVerify.validate({\n receipt: appleReceipt,\n device: '438498A7-4850-41DB-BCBE-4E1756378E39'\n });\n \n // todo\n}\ncatch (e) {\n if (e instanceof appleReceiptVerify.EmptyError) {\n // todo\n }\n else if (e instanceof appleReceiptVerify.ServiceUnavailableError) {\n // todo \n }\n}\n\n// Override environment\nappleReceiptVerify.validate({\n receipt: appleReceipt,\n device: '438498A7-4850-41DB-BCBE-4E1756378E39',\n environment: ['sandbox' ]\n }, (err, products) => {\n if (err) {\n return console.error(err);\n }\n // ok!\n});\n\n```\n\n### Errors\n\nErrors can have additional optional properties:\n\n* isRetryable (bool) - true if Apple service recommends to retry request a bit more later.\n* appleStatus (number) - status returned by Apple validation service.\n\n#### Special errors\n\n##### EmptyError - returned in case of receipt without purchase\n\n```\nconst appleReceiptVerify = require('node-apple-receipt-verify');\nconst EmptyError = appleReceiptVerify.EmptyError;\n```\n\n##### ServiceUnavailableError - returned when Apple validation service returned, e.g: 503, etc.\n\nYou can retry request later.\n\n### Author\n* Siarhei Ladzeika < <sergey.ladeiko@gmail.com> >\n\n## LICENSE\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n"
"readme": "# node-apple-receipt-verify\n\nA Node.js module for Apple In-App-Purchase receipt validation for iOS.\n### Note: Storekit Versions:\nThis works module with the (older) Storekit API, the newer [Storekit 2](https://developer.apple.com/storekit/) uses JWT tokens which can be verified without an API call to Apple\n\n\n### Changes\n\nSee [CHANGELOG](CHANGELOG.md)\n\n### Debug Logging\n\nThe module can optionally turn on verbose debug log.\n\nIn order to enable the verbose logging, give the following to `.config()`:\n\n```javascript\nvar appleReceiptVerify = require('node-apple-receipt-verify');\nappleReceiptVerify.config({\n verbose: true\n});\n```\n\n### Methods\n\n#### .config(options [object])\n\nInitializes module. Can be called more than once to reconfigure module.\n\n**options**: supports following keys:\n- `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]\n- `verbose` \\[boolean\\] \\[optional\\] - verbose logging switch, `false` by default. [optional]\n- `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']`.\n- `ignoreExpiredError` \\[boolean\\] \\[optional\\] - if true, then does not return error if receipt is expired. Default is false.\n- `ignoreExpired` \\[boolean\\] \\[optional\\] - if `true`, then expired purchases are skipped. Defaults to `true`.\n- `extended` \\[boolean\\] \\[optional\\] - if `true`, then purchases contains extended information. Defaults to `false`. (since v1.1.1)\n- `excludeOldTransactions` \\[boolean\\] \\[optional\\] - If value is true, response includes only the latest renewal transaction for any subscriptions ([Apple Documentation](https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW3)).\n\n#### .config()\n\nReturns current global config.\n\n#### .validate(options [object], callback [function (err, purchasedProducts [array of objects ])])\n\nValidates an in-app-purchase receipt.\n\n**options**: supports keys:\n- `receipt` \\[required\\] - base64 encoded receipt.\n- `device` \\[optional\\] - iOS vendor identifier. NOTE: [deprecated]\n\nYou can also add options passed to ```config()```, they override default options.\n\n**callback** \\[optional\\]: receives error or list of purchased products embedded in receipt.\n\nThe purchased products list has structure:\n\n```\n[\n{\n bundleId: <string>,\n transactionId: <string>,\n productId: <string>,\n purchaseDate: <number>,\n quantity: <number>,\n *expirationDate: <number>,\n *isTrialPeriod: <boolean>, // only for subscriptions and if extented = true\n *isInIntroOfferPeriod: <boolean>, // only for subscriptions and if extented = true, since v1.5.1\n *environment: <string>, // only if extented = true\n *originalPurchaseDate: <number>, // only if extented = true\n *applicationVersion: <string>, // only if extented = true\n *originalApplicationVersion: <string> // only if extented = true\n},\n...\n]\n```\n\n### Usage\n\n```javascript\nconst appleReceiptVerify = require('node-apple-receipt-verify');\n\n// Common initialization, later you can pass options for every request in options\nappleReceiptVerify.config({\n secret: \"1234567890abcdef1234567890abcdef\",\n environment: ['sandbox']\n});\n\n// Callback version\nappleReceiptVerify.validate({\n receipt: appleReceipt,\n device: '438498A7-4850-41DB-BCBE-4E1756378E39'\n }, (err, products) => {\n if (err) {\n return console.error(err);\n }\n // ok!\n});\n\n// Callback version without device\nappleReceiptVerify.validate({\n receipt: appleReceipt\n }, (err, products) => {\n if (err) {\n return console.error(err);\n }\n // ok!\n});\n\n// Promise version\ntry {\n \n const products = await appleReceiptVerify.validate({\n receipt: appleReceipt,\n device: '438498A7-4850-41DB-BCBE-4E1756378E39'\n });\n \n // todo\n}\ncatch (e) {\n if (e instanceof appleReceiptVerify.EmptyError) {\n // todo\n }\n else if (e instanceof appleReceiptVerify.ServiceUnavailableError) {\n // todo \n }\n}\n\n// Override environment\nappleReceiptVerify.validate({\n receipt: appleReceipt,\n device: '438498A7-4850-41DB-BCBE-4E1756378E39',\n environment: ['sandbox' ]\n }, (err, products) => {\n if (err) {\n return console.error(err);\n }\n // ok!\n});\n\n```\n\n### Errors\n\nErrors can have additional optional properties:\n\n* isRetryable (bool) - true if Apple service recommends to retry request a bit more later.\n* appleStatus (number) - status returned by Apple validation service.\n\n#### Special errors\n\n##### EmptyError - returned in case of receipt without purchase\n\n```\nconst appleReceiptVerify = require('node-apple-receipt-verify');\nconst EmptyError = appleReceiptVerify.EmptyError;\n```\n\n##### ServiceUnavailableError - returned when Apple validation service returned, e.g: 503, etc.\n\nYou can retry request later.\n\n### Author\n* Siarhei Ladzeika < <sergey.ladeiko@gmail.com> >\n\n## LICENSE\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n"
}
# 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](https://developer.apple.com/storekit/) uses JWT tokens which can be verified without an API call to Apple
### Changes

@@ -6,0 +9,0 @@

@@ -42,2 +42,3 @@ 'use strict';

"bid": "com.myapp",
"app_account_token": '1',
"product_id": "com.myapp.product",

@@ -66,2 +67,3 @@ "purchase_date": "2018-05-21 13:11:11 Etc/GMT",

"web_order_line_item_id": "251200091943117",
"app_account_token": '1',
"version_external_identifier": "826299857",

@@ -87,3 +89,5 @@ "product_id": "com.myapp.product",

quantity: 1,
expirationDate: 1526908271000
expirationDate: 1526908271000,
webOrderLineItemId: '251200091943117',
web_order_line_item_id: '251200091943117',
}

@@ -101,2 +105,3 @@ ];

originalTransactionId: '250000287737863',
appAccountToken: '1',
pendingRenewalInfo: [

@@ -227,2 +232,3 @@ {

web_order_line_item_id: '250000091943118',
app_account_token: '1',
bid: 'com.myapp',

@@ -254,2 +260,3 @@ product_id: 'com.myapp.product',

web_order_line_item_id: '251200091943117',
app_account_token: '1',
version_external_identifier: '826299857',

@@ -306,2 +313,3 @@ product_id: 'com.myapp.product',

web_order_line_item_id: '250000091943118',
app_account_token: '1',
bid: 'com.myapp',

@@ -333,2 +341,3 @@ product_id: 'com.myapp.product',

web_order_line_item_id: '251200091943117',
app_account_token: '1',
version_external_identifier: '826299857',

@@ -335,0 +344,0 @@ product_id: 'com.myapp.product',

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc