Skip to content

Commit 87a6f6a

Browse files
Nandesora TjiheroNandesora Tjihero
authored andcommitted
Added API description for the Payments: IAP & Subscriptions plugin
1 parent 28dc90a commit 87a6f6a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

plugins/payments.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ for Google Play Billing](https://developer.android.com/google/play/billing/test)
8383
This plugin uses a RxJS Observable to emit the events to handle the purchase flow. To avoid threading errors with the platform purchasing flow, you can use `toMainThread()` as a pipe on the Observable so that the purchase logic executes on the main thread. `paymentEvents.pipe(toMainThread()).subscribe((event: PaymentEvent.Type) => {...`
8484
The sample below should give a good starting point on how to use the Observable and setup the purchasing mechanism.
8585

86+
## API
87+
88+
- `init()` Sets up the internal system of the plugin.
89+
- `paymentEvents` The RxJS Observable to emit the events to handle the purchase flow.
90+
91+
The following methods get called in response to the events emitted by `paymentEvents`.
92+
93+
| Methods | Description |
94+
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
95+
| `fetchItems(itemIds: Array<string>)` | Queries the store for the items requested. You should handle these items inside the `PaymentEvent.Context.RETRIEVING_ITEMS` event. |
96+
| `buyItem(item: Item, options?: BuyItemOptions)` | Starts the purchase flow on Android & iOS and emits `PaymentEvent.Context.PROCESSING_ORDER` with `SUCCESS` or `FAILURE`. If SUCCESS then you can call the last method to the `finalizeOrder(payload)`. |
97+
| `fetchSubscriptions(itemIds: Array<string>)` | Queries the store for the subscriptions offered by the app. You should handle these subscriptions inside the `PaymentEvent.Context.RETRIEVING_ITEMS` event. |
98+
| `startSubscription(item: Item, userData?: string)` | `Android only`. Lanches the billing flow by presenting the Google Store subscription UI interface. |
99+
| `restoreOrders(skuType?: string)` | Returns the purchase made by the user for each product. You call this method to install purchases on additional devices or restore purchases for an application that the user deleted and reinstalled. |
100+
| `canMakePayments()` | Returns `true` or `false` indicating whether the billing service is available and is setup successfully. |
101+
| `tearDown()` | Closes the connection to the billing service to free up resources. |
102+
86103
## Usage
87104

88105
The standard flow of method calls:

0 commit comments

Comments
 (0)