Die NODE.JS -Serverbibliothek für die App Store Server API und den App Store Server -Benachrichtigungen. Auch in Swift, Python und Java erhältlich.
Installation
Dokumentation
Verwendung
Unterstützung
Knoten 16+
# Mit NPMNPM Installation @Apple/App Store-Server-Library--Save# mit Yarnyarn add @Apple/App Store-Server-Library hinzufügen
Dokumentation
WWDC -Video
Um die App Store Server -API zu verwenden oder Signaturen für Werbeangebote zu erstellen, ist eine vom App Store Connect heruntergeladene Signatur erforderlich. Um diesen Schlüssel zu erhalten, müssen Sie die Administratorrolle spielen. Gehen Sie zu Benutzern und Zugriffe> Integrationen> In-App-Kauf. Hier können Sie Schlüssel erstellen und verwalten und Ihre ID -ID finden. Wenn Sie einen Schlüssel verwenden, benötigen Sie auch die wichtige ID und die ID -ID.
Laden Sie die Root -Zertifikate herunter und speichern Sie die im Abschnitt Apple Root Certificate der Apple PKI -Site gefundenen Stammzertifikate. Geben Sie diese Zertifikate als Array für einen signiertenDataverifier zur Verfügung, um die Überprüfung der unterzeichneten Daten von Apple zu ermöglichen.
importieren {appstoresserverapiclient, Umgebung, sendTestNotificationResponse} aus "@Apple/App Store-Server-Library" const isuerid = "99b16628-15e4-4668-972b-eeeff5555 const keyid =" abcdefgeij "const buneid =" com.Ex-clampe " filepath = "/path/to/key/subscriptionkey_abcdefghij.p8"constcodedKey = ReadFile (Filepath) // Spezifische Implementierung kann varyconst Environment = Umwelt variieren. Antwort: sendTestNotificationResponse = Warte client Importieren {signedDataVerifier} aus "@Apple/App Store-Server-Library" const buntdeleid = "com.example" const applerootcas: buffer [] = loadrootcas () // spezifische Implementierung kann VaryConst EnableAnLinEchcks = trueconst umwelt = = UNDEFINED // Appappleid ist erforderlich, wenn die Umgebung protctionconst verifier = new SignedDataVerifier (Applerootcas, enableOnLinEchecks, Umgebung, Bündelung, Appappleid) ConsteroptificationPayload = "EY ..." const VerifiedNotification = Await verifier.verifyDeCodenotification (NotifictifydoLode) Konsole verifiziert) importieren {appstoresserverapiclient, Umgebung, GetTransactionHistoryVersion, Quittung, Bestellung, Produkttyp, HistoryResponse, TransactionHistoryRequest} aus "@Apple/App Store-Server-Library" CONSPRARY "contrary" contrary "99B16628-15E4-468-972B-EEEEFF5555" "const bundleId = "com.example"const filePath = "/path/to/key/SubscriptionKey_ABCDEFGHIJ.p8"const encodedKey = readFile(filePath) // Specific implementation may varyconst environment = Environment.SANDBOXconst client =new AppStoreServerAPIClient(encodedKey, keyId , IssuerID, BunddleId, Umgebung) const cre was caaleipt = "mi ..." const Quittel = new eckigility () const transactionId = extransactil.extransactionIdFromApreceipt (correakteipt) if (transactionId! Aufsteigend, widerrufen: false, productTypes: [productType.auto_renewable]} Lassen Sie die Antwort: HistoryResponse | null = nulllet transaktionen: string [] = [] tun {const revisionToken = response! == null && response.revision! == null? response.revision: nullResponse = warte client Transaktionen)} Import {PromotionalOfferSignatureCreator} aus "@Apple/App Strear-Server-library" const keyid = "abcdefghij" const buntdyl = "com.example" const filepath = "/path/to/key/key/key/key/key (filepath) // Spezifische Implementierung kann varyconst productID = "<product_id>" const subscriptionOFFerID = "<subscription_offer_id>" const ApplicationUnername = "<Application_USERNAME>" const nonce = "<nonce>" const timestamp = Date.now () const SignatureReator = NEUER PROMOTOOTOMOFTERSIGNORTECREATOR (CodedKey, KeyId, Bündel) const Signature = SignatureCreator.CreateSignature (ProductID, AbonnementFerid, ApplicationUnername, Nonce, Timestamp) Konsole.log (Signature)Nur die neueste Hauptversion der Bibliothek erhält Updates, einschließlich Sicherheitsupdates. Daher wird empfohlen, neue Hauptversionen zu aktualisieren.