types-apple-iap
v1.0.1
Published
Typescript typings for Apple in-app purchases.
Downloads
2,074
Maintainers
Readme
types-apple-iap
Typescript typings for Apple in-app purchases. Use to add strong types to Apple verifying receipts for in-app purchases and Apple Server to Server notifications.
Before:
const responseBody: any = // Notification from Apple or HTTP response body from verifying a receipt.
const latestTransactions: any = responseBody.latest_receipt_info // Hope there isn't a typo in there or you will have a runtime exception!
After:
const responseBody: AppleVerifyReceiptResponseBody = // Notification from Apple or HTTP response body from verifying a receipt.
const latestTransactions: AppleLatestReceiptTransaction[] = responseBody.latest_receipt_info // Ah! Much better!
Tip: Check out the npm module dollabill-apple
to make your life much easier working with Apple verifying receipts and server-to-server notifications.
Why use types-apple-iap?
- [X] Full documentation. Check out the full API reference!
- [X] Version controlled. As Apple updates their response body, this project updates it's typings. Update the typings when your project is ready.
- [X] Deprecated fields from Apple are not present in this project. This helps you keep your project compliant with Apple's changes.
Documentation
Here you will find the full API reference for all of the typings in this repo.
Getting started
- Install typings:
npm install --save-dev types-apple-iap
- Use in your code:
import {AppleVerifyReceiptResponseBody, AppleServerNotificationResponseBody} from "types-apple-iap"
const responseBody: AppleVerifyReceiptResponseBody = // HTTP response body from verifying a receipt.
const notificationResponseBody: AppleServerNotificationResponseBody = // Notification from Apple.
Contributors
Thanks goes to these wonderful people (emoji key)