Zum Hauptteil springen

inAppPurchase

History
Version(s)Changes
None
API ADDED

In-App-Käufe im Mac App Store.

Process: Main

Ereignisse

Das inAppPurchase Modul sendet folgende Ereignisse aus:

Event: 'transactions-updated'

History
Version(s)Changes
None
API ADDED

Kehrt zurück:

  • event Event
  • transactions Transaction[] - Array of Transaction objects.

Wird ausgelöst, wenn eine oder mehrere transactions aktualisiert wurden.

Methoden

Das Modul inAppPurchase verfügt über die folgenden Methoden:

inAppPurchase.purchaseProduct(productID[, opts])

History
Version(s)Changes
None

This method now returns a Promise instead of using a callback function.

None

Added username option to opts parameter.

None
API ADDED
  • productID zeichenkette
  • opts Integer | Object (optional) - Definiert die Menge, wenn als Integer angegeben.
    • quantity Integer (optional) - Anzahl der Gegenstände, die der Benutzer kaufen möchte.
    • username string (optional) - Der string, der die Transaktion mit einem Benutzerkonto auf Ihrem Dienst (applicationUsername) verknüpft.

Gibt Promise<boolean> zurück - Gibt true zurück, wenn das Produkt gültig ist und zur Zahlungswarteschlange hinzugefügt wurde.

You should listen for the transactions-updated event as soon as possible and certainly before you call purchaseProduct.

inAppPurchase.getProducts(productIDs)

History
  • productIDs string[] - Die Identifikatoren des zu erhaltenden Produktes.

Returns Promise<Product[]> - Resolves with an array of Product objects.

Ruft die Produktbeschreibungen ab.

inAppPurchase.canMakePayments()

History
Version(s)Changes
None
API ADDED

Gibt boolean zurück - ob ein Benutzer eine Zahlung leisten kann.

inAppPurchase.restoreCompletedTransactions()

History
Version(s)Changes
None
API ADDED

Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.

The payment queue delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.

inAppPurchase.getReceiptURL()

History
Version(s)Changes
None
API ADDED

Gibt string zurück - den Pfad zur Quittung.

inAppPurchase.finishAllTransactions()

History
Version(s)Changes
None
API ADDED

Erledigt alle ausstehenden Transaktionen.

inAppPurchase.finishTransactionByDate(date)

History
Version(s)Changes
None
API ADDED
  • date string - The ISO formatted date of the transaction to finish.

Completes the pending transactions corresponding to the date.