app store server library node
1.4.0
App Store Server APIおよびApp Store Serverの通知用のNode.jsサーバーライブラリ。 Swift、Python、Javaでも利用できます。
インストール
ドキュメント
使用法
サポート
ノード16+
#NPMNPM付き @Apple/App-Store-Server-Library - save#with yarnyarn add @apple/app-store-server-library
ドキュメント
WWDCビデオ
App Store Server APIを使用するか、プロモーションオファーの署名を作成するには、App Store Connectからダウンロードされた署名キーが必要です。このキーを取得するには、管理者の役割が必要です。ユーザーに移動して、アクセス> [統合]> [In-In-App購入]に移動します。ここでは、キーを作成および管理したり、発行者IDを見つけることができます。キーを使用する場合、キーIDと発行者IDも必要です。
Apple PKIサイトのAppleルート証明書セクションにあるルート証明書をダウンロードして保存します。これらの証明書を署名されたデータの配列として配列として提供して、署名されたデータの確認を許可します。
Import {AppStoreServerApiclient、Environment、SendTestNotificationResponse} from "@apple/app-store-server-library" const issuerid = "99b16628-15e4-4668-972b-eeff55555555555" filepath = "/path/to/key/subscriptionkey_abcdefghij.p8"const encodedkey = readfile(filepath)//特定の実装は、環境=環境=環境=環境= new appstoreServerapiclient(encodedkey、keyid、evention、bundleid、bundleid、bundleid、bundleid、bundleid、constutederverapiclient = new appstoreerverapiclient(応答:SendTestNotificationResponse = await Client.RequestTestNotification()console.log(response)} catch(e){console.error(e)}「@apple/app-store-server-library」const bundleid = "com.example" const appreootcas:buffer [] = loadrootcas()//特定の実装がvaryconst enabableon checks = trueconst環境=環境=環境.sandboxconstのアポジュウガム=未定義の//環境がProductionConst Verifierである場合、AppAppleidが必要です= new SignedDataverifier(AppreOtcas、EnableonLineChecks、Environment、bundleid、AppAppleid)const notificationPayload = "const verififiednotification = awaint verifier.verifier.verifyanddecodenotification verifiednotification)
Import {AppStoreServerApiclient、環境、getTransactionHistoryversion、ReceideUtility、Order、ProductTipe、historyResponse、transactionHistoryRequest} from "@apple/app-store-server-library" const issuerid = "99b16628-15e4-4668-972b-eeff5efiff55" "const bundleid =" com.example "const filepath ="/path/to/key/subscriptionkekey_abcdefghij.p8"const encodedkey = readfile(filepath)//特定の実装は環境=環境=環境の変化する場合があります。 、Issuerid、bundleid、環境)const hepheipt = "mi ..." const receatedutil = new Recearthutility()const transactionId = receptionUtil.extractransactionidfromAppreceipt(hephedeipt)if(transactionId!= null){const transactionHistoreRequest:transactionHistorequest = {SOT:ORDER。昇順、Revoked:false、fortTypes:[croductType.auto_renewable]} let response:historyResponse | null = nullletトランザクション:string [] = [] do {const revisiontoken = respons!== null && response.revision!== null? Response.Revision:nullResponse = await Client.getTransactionHistory(transactionId、RevisionToken、TransactionHistoryRequest、getTransactionHistoryversion.v2)if(respons.signedtransactions){transactions.concat(response.signedtransactions)}トランザクション)}「@apple/app-store-server-library "const keyid =" abcdefghij "const bundleid =" com.example "const filepath/to/key/subscriptionkekey_abcdefghij.p8"const encodedKey = readfile (filepath)//特定の実装はvaryconst productid = "<product_id>" const subscription offerid = "<subscription_offer_id>" const applicationusername = "<アプリケーション_username>" const nonce = "<nonce>" = new PromotionalOfferSignatureCreator(encodedKey、keyID、bundleid)const signature = signaturecreator.createsignature(productid、subscriptionofferid、application -sername、nonce、timestamp)console.log(署名)(署名)
ライブラリの最新のメジャーバージョンのみが、セキュリティの更新を含むアップデートを受け取ります。したがって、新しい主要バージョンに更新することをお勧めします。