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
Easily implement Flutterwave for payments in your React Native appliction. This library supports both Android and iOS, and use the Flutterwave's V3 API.
6
+
7
+
Easily implement Flutterwave for payments in your React Native appliction. This library supports both Android and iOS, and use the Flutterwave's V3 API.
@@ -45,59 +46,92 @@ Easily implement Flutterwave for payments in your React Native appliction. This
45
46
-[Contributing](./CONTRIBUTING.md)
46
47
47
48
## What's Inside?
49
+
48
50
- Pay with Flutterwave button and checkout dialog.
49
51
- Standard payment initialization function.
50
52
- Flutterwave designed button.
51
53
52
54
## :warning: If Using Version 2 API :warning:
55
+
53
56
This version of the library's docs focuses on use cases with the Version 3 of Flutterwaves API, if you are still using the Version 2 API please use [this documentation](./README.v2.md) instead.
54
57
55
58
## Installation
59
+
56
60
This library is available on npm, you can install it by running `npm install --save flutterwave-react-native` or `yarn add flutterwave-react-native`
57
61
58
62
### Dependencies
63
+
59
64
In order to render the Flutterwave checkout screen this library depends on [react-native-webview](https://github.com/react-native-community/react-native-webview) ensure you properly install this library before continuing.
60
65
61
66
### Activity Indicator (only needed for android)
67
+
62
68
To display the Flutterwave styled activity indicator when the checkout screen is being loaded on Android you will need to add some modules in `android/app/build.gradle`.
63
-
***Skip this if you already have setup your app to support gif images.***
64
-
````javascript
69
+
**_Skip this if you already have setup your app to support gif images._**
70
+
71
+
```javascript
65
72
dependencies {
66
73
// If your app supports Android versions before Ice Cream Sandwich (API level 14)
In order to use this library you are required to use your merchant public key and not the secret key. See how to get your API Keys [here](https://developer.flutterwave.com/v3.0/docs/api-keys)
76
84
77
85
### :fire: IMPORTANT INFORMATION :fire:
86
+
78
87
If the `options` property on [PayWithFlutterwave](#paywithflutterwaveprops-interface) changes, when next the user taps on the button a new payment will be initialized whether the last one was successful or not.
79
88
80
89
Remember you cannot use the same transaction reference for two different payments, also remember to recreate the transaction reference before allowing the user initiate a new payment.
81
90
82
-
83
91
## Usage
92
+
84
93
Below are a few examples showcasing how you can use the library to implement payment in your React Native app.
When called, this function returns a Promise which resolves to a string on success and rejects if an error occurs. [See all config options](#flutterwaveinitoptions)
157
207
158
208
Import `FlutterwaveInit` from `flutterwave-react-native` and use it like so.
:wave: Hi, so there are cases where you have already initialized a payment with `FlutterwaveInit` but might also want to be able to cancel the payment initialization should in case your component is being unmounted or you want to allow users cancel the action before the payment is initialized, we have provided a way for you to do this... [continue reading](./docs/AbortingPaymentInitialization.md)
| authorization | Yes | string |**REQUIRED**| Your merchant public key, see how to get your [API Keys](https://developer.flutterwave.com/v3.0/docs/api-keys)|
191
245
| tx_ref | Yes | string |**REQUIRED**| Your transaction reference. This MUST be unique for every transaction.|
@@ -195,14 +249,15 @@ try {
195
249
| payment_options | Yes | string |**REQUIRED**| This specifies the payment options to be displayed e.g - card, mobilemoney, ussd and so on. |
196
250
| payment_plan | No | number | undefined | This is the payment plan ID used for [Recurring billing](https://developer.flutterwave.com/v3.0/docs/recurring-billing). |
197
251
| redirect_url | Yes | string |**REQUIRED**| URL to redirect to when a transaction is completed. This is useful for 3DSecure payments so we can redirect your customer back to a custom page you want to show them. **IMPORTANT** This only required when you are directly using [FlutterwaveInit](#flutterwave-standard-init)|
198
-
| customer | Yes |[FlutterwaveInitCustomer](#flutterwaveinitcustomer)|**REQUIRED**| This is an object that can contains your customer details. `E.g.'customer': { 'email': 'example@example.com', 'phonenumber': '08012345678', 'name': 'Takeshi Kovacs' }.`|
252
+
| customer | Yes |[FlutterwaveInitCustomer](#flutterwaveinitcustomer)|**REQUIRED**| This is an object that contains your customer details. `E.g.'customer': { 'email': 'example@example.com', 'phonenumber': '08012345678', 'name': 'Takeshi Kovacs' }.`|
199
253
| subaccounts | No | array of [FlutterwaveInitSubAccount](#flutterwaveinitsubaccount)| undefined | This is an array of objects containing the subaccount IDs to split the payment into. Check out the [Split Payment page](https://developer.flutterwave.com/docs/split-payment) for more info |
200
254
| meta | No |[FlutterwavePaymentMeta](#flutterwavepaymentmeta)| undefined | This is an object that helps you include additional payment information to your request. `E.g. { 'consumer_id': 23, 'consumer_mac': '92a3-912ba-1192a' }`|
201
255
| customizations | No |[FlutterwaveInitCustomizations](#flutterwaveinitcustomizations)| undefined | This is an object that contains title, logo, and description you want to display on the modal `E.g. {'title': 'Pied Piper Payments', 'description': 'Middleout isn't free. Pay the price', 'logo': 'https://assets.piedpiper.com/logo.png'}`|
| style | No | object | undefined | Used to apply styling to the button.|
208
263
| onRedirect | Yes | function |**REQUIRED**| Called when a payment is completed successfully or is canceled. The function will receive [redirect params](#redirectparams) as an argument.|
@@ -215,51 +270,58 @@ try {
215
270
| alignLeft | No | boolean | undefined | This aligns the content of the button to the left. |
0 commit comments