You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/payments.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,23 @@ for Google Play Billing](https://developer.android.com/google/play/billing/test)
83
83
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) => {...`
84
84
The sample below should give a good starting point on how to use the Observable and setup the purchasing mechanism.
85
85
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`.
|`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. |
0 commit comments