Turn addTransactionListener into transaction-updated event
This commit is contained in:
parent
ac6f895f64
commit
133bef3deb
5 changed files with 80 additions and 37 deletions
|
@ -1,29 +1,35 @@
|
|||
# inAppPurchase _macOS_
|
||||
|
||||
> In-App Purchase on Mac App Store.
|
||||
> In-app purchases on Mac App Store.
|
||||
|
||||
Your application should add a listener before to purchase a product. If there are no listener attached to the queue, the payment queue does not synchronize its list of pending transactions with the Apple App Store.
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
## Events
|
||||
|
||||
The `inAppPurchase` module emits the following events:
|
||||
|
||||
### Event: 'transaction-updated'
|
||||
|
||||
Emitted when a transaction has been updated.
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `payment` Object
|
||||
* `productIdentifier` String
|
||||
* `quantity` Integer
|
||||
* `transaction` Object
|
||||
* `transactionIdentifier` String
|
||||
* `transactionDate` String
|
||||
* `originalTransactionIdentifier` String
|
||||
* `transactionState` String - The transaction sate (`"SKPaymentTransactionStatePurchasing"`, `"SKPaymentTransactionStatePurchased"`, `"SKPaymentTransactionStateFailed"`, `"SKPaymentTransactionStateRestored"`, or `"SKPaymentTransactionStateDeferred"`)
|
||||
* `errorCode` Integer
|
||||
* `errorMessage` String
|
||||
|
||||
## Methods
|
||||
|
||||
The `inAppPurchase` module has the following methods:
|
||||
|
||||
### `inAppPurchase.addTransactionListener(listener)`
|
||||
|
||||
* `listener` Function - Called when transactions are updated by the payment queue.
|
||||
* `payment` Object
|
||||
* `productIdentifier` String
|
||||
* `quantity` Integer
|
||||
* `transaction` Object
|
||||
* `transactionIdentifier` String
|
||||
* `transactionDate` String
|
||||
* `originalTransactionIdentifier` String
|
||||
* `transactionState` String - The transaction sate (`"SKPaymentTransactionStatePurchasing"`, `"SKPaymentTransactionStatePurchased"`, `"SKPaymentTransactionStateFailed"`, `"SKPaymentTransactionStateRestored"`, or `"SKPaymentTransactionStateDeferred"`)
|
||||
* `errorCode` Integer
|
||||
* `errorMessage` String
|
||||
|
||||
Add a listener to transactions.
|
||||
|
||||
### `inAppPurchase.purchaseProduct(productID, quantity, callback)`
|
||||
|
||||
* `productID` String - The id of the product to purchase. (the id of `com.example.app.product1` is `product1`).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue