@jeremybarbet/node-iap v1.5.1
@jeremybarbet/node-iap
Node.js library for Apple and Google IAP.
Installation
yarn add @jeremybarbet/node-iapGetting a service account up and running is surprisingly really hard. Mostly, because of a mix of permissions, scopes, and order in which you are doing all these operations has a huge impact.
- I recommend following this official documentation to create a new service account. This library use service account's clientEmail and privateKey, so you can ignore the "OAuth client" paragraphs.
Apple
- Generate an Apple password through the App Store Connect. I recommend creating an "app-specific shared secret".
Usage
import { verifyAppleReceipt, verifyGoogleReceipt } from '@jeremybarbet/node-iap';
const { data } = verifyAppleReceipt(
{
transactionReceipt: 'BASE_64_RECEIPT',
},
{
password: 'APPLE_PASSWORD',
},
);
const { data } = verifyGoogleReceipt(
{
packageName: 'PACKAGE_NAME',
token: 'TOKEN',
productId: 'PRODUCT_ID',
},
{
clientEmail: 'GOOGLE_CLIENT_EMAIL',
privateKey: 'GOOGLE_PRIVATE_KEY',
},
);Example
You can find an example in the example directory.
You will first, need to duplicate the data.example.json file, rename it data.json and provide your own Apple and Google credentials and receipt data. Then you can run the example:
yarn ts-node ./packages/node-iap/example/index.tsSupported platforms
- Apple
Acknowledgments
- Part of the code and features are inspired by in-app-purchase's library.
License
This library is licensed under the MIT License.
5 months ago
5 months ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago