app store server library node
1.4.0
App Store Server API 및 App Store Server 알림 용 Node.js 서버 라이브러리. Swift, Python 및 Java에서도 제공됩니다.
설치
선적 서류 비치
용법
지원하다
노드 16+
# npmnpm install @apple/app-store-server-library-yarnyarn add @apple/app-store-server-library
선적 서류 비치
WWDC 비디오
App Store Server API를 사용하거나 프로모션 제안 서명을 만들려면 App Store Connect에서 다운로드 한 서명 키가 필요합니다. 이 키를 얻으려면 관리자 역할이 있어야합니다. 사용자 및 액세스> 통합> 인앱 구매로 이동하십시오. 여기에서 키를 만들고 관리하고 발행인 ID를 찾을 수 있습니다. 키를 사용하는 경우 키 ID와 발급자 ID도 필요합니다.
Apple PKI 사이트의 Apple Root 인증서 섹션에있는 루트 인증서를 다운로드하여 저장하십시오. 서명 된 데이터가 Apple에서 오는 것을 확인할 수 있도록 SignedDataverifier의 배열 로이 인증서를 제공하십시오.
import {AppStoreserVerapiclient, 환경, SendTestNotificationResponse} "@Apple/App-Store-Server-Library"const issuerid = "99B16628-15E4-4668-972B-EEFF55eeff55"const keyid = "Abcdefghij"const bundleid = "const bundleid =" filepath = "/path/to/key/subscriptionkey_abcdefghij.p8"const encodedkey = readfile (filepath) // 특정 구현은 varyconst 환경 = 환경 .SandboxConst 클라이언트 = 새로운 AppStoresERVERVERVERVERAPICLIENT (congedkey, keyid, vissuerid, bundle, 환경) 일 수 있습니다. 응답 : sendTestNotificationResponse = Await Client.RequestTestNotification () Console.Log (응답)} Catch (e) {Console.Error (e)} "@apple/app-store-server-library"const bundleid = "com.example"const applerootcas : buffer [] = loadrootcas () // 특정 구현이 varyconst enableonlinechecks = trueconst 환경 = 환경 .sandboxconst appappleid에서 {signeddataverifier}} import = undefined // appAppleid는 환경이 ProductionConst verifier = 새로운 signeddataverifier (applerootcas, enableonlinechecks, 환경, 번들 리드, AppAppleId) const notificationpayload = "ey ..."const verifier.verifyanddecodenotification (notificationpayload.log)에 필요합니다. 검증 노화) import {appstoreserverapiclient, 환경, GetTransactionHistoryVersion, 영수증, 주문, 제품 유형, HistoryResponse, TransactionHistoryRequest} "@Apple/App-Store-Server-Library"const issuerid = "99B16628-15E4-468-972B-EEFF55555555555555555555555555 55 "const bundleid ="com.example "const filepath ="/path/to/key/subscriptionkey_abcdefghij.p8"concodedkey = readfile (filepath) // 특정 구현이 VaryConst 환경 = 환경 .SandboxConst 클라이언트 = new AppStoreServerApiclient (EncodedKey, KeyID). , issuerid, bundleid, 환경) const seploinipt = "mi ..."const reciputil = new 영수증 () const transactionId = int 오름차순, 취소 : False, ProductTypes : [ProductType.Auto_Renewable]} 응답을하자 : Historresponse | null = nulllet transactions : string [] = [] do {const revisiontoken = response! == null && response.revision! == null? Response.revision : nullResponse = Await Client.GetTransactionHistory (TransactionId, RevisionToken, TransactionHistoryRequest, getTransactionSactionHistoryVersion.v2) if (response.signedTransactions) {transactions.concat (response.signedtransactions)} while (response.log) 업무)}"@apple/app-store-server-library"const keyid = "abcdefghij"const bundleid = "com.example"const filepath = "/spath/toto/key/subscriptkey_abcdefghij.p8"const encodedkey = readfile (FilePath) // 특정 구현이 VaryConst productId = "<product_id>"const subscriptionofferid = "<subscription_offer_id>"const applicationUsername = "<plaction_username>"const nonce = "<nonce>"const timestamp = date.now (const signaturecreator = New PromotionalOfferSignaturecReator (encodedKey, keyId, bundleid) const signature = signaturecreator.createsignature (productID, SubscriptionOfFerid, ApplicationUserName, Nonce, Timestamp) console.log (signature)
라이브러리의 최신 주요 버전 만 보안 업데이트를 포함하여 업데이트를 받게됩니다. 따라서 새로운 주요 버전으로 업데이트하는 것이 좋습니다.