Skip to content

levibostian/types-apple-iap

Repository files navigation

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?

  • Full documentation. Check out the full API reference!
  • Version controlled. As Apple updates their response body, this project updates it's typings. Update the typings when your project is ready.
  • 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)


Levi Bostian

💻 📖 🚧