Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 1.57 KB

File metadata and controls

37 lines (30 loc) · 1.57 KB

Server for handling App Store Server Notifications

A server (endpoint) that handles App Store Server Notifications for Monitoring In-App Purchase events in real time and learn of unreported external purchase tokens.

For more details, please refer to my blog A Server Endpoint For App Store Server Notifications

Set up Env

  • PRIVATE_KEY, KEY_ID, and ISSUER_ID is only used for sending test notifications. If that is not needed, those don't have to be included.
# P8 private key (subscription key) obtained from App Store Connect > Users and Access > Key > In App Purchase
PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\...\n...\n...\n-----END PRIVATE KEY-----"
# key id for the private key
KEY_ID="..."
# issued obtained from the same place as private key
ISSUER_ID="...-...-...."
# app bundle Id that the in app purchase is set up for (ie: app store server notification is sent for)
APP_BUNDLE_ID="com.example.myApp"
# Apple Id obtained from App store connect > app general information for the app above
# Required for production environment
APP_APPLE_ID="..."
# Sandbox or Production: https://developer.apple.com/documentation/appstoreserverapi/environment
APN_ENVIRONMENT="Sandbox"

Deployment

  • Vercel/Lambda/Edge function will work.
    • Remember to Remove builtin authentication
  • CloudFlare workers will NOT work because it is basically run as a client environment where Apple's App Store Server SDK (@apple/app-store-server-library) requires server environment