该套件允许您使用 paystack 收取付款,而且最棒的是,不需要绑定! 只需安装即可开始使用
该套件允许您使用 paystack 收取付款,而且最棒的是,不需要绑定! 只需安装即可开始使用
React Native Paystack WebView (v5)
Modern, hook-based, Paystack-powered payments in React Native apps using WebViews — now streamlined with Provider architecture & fully customizable.
Endorsed by Paystack, so you know you’re in good hands. Payment processing has never been this easy!
npm install react-native-paystack-webview
# or
yarn add react-native-paystack-webviewyarn add react-native-webview
# iOS
cd ios && pod install
# Expo
npx expo install react-native-webviewimport { PaystackProvider } from 'react-native-paystack-webview';
…checkout() or newTransaction() callsonGlobalSuccess or onGlobalCanceldebug propPaystackProvider| Prop | Type | Default | Description |
|---|---|---|---|
publicKey |
string |
— | Your Paystack public key |
currency |
string |
— | Currency code (optional) |
defaultChannels |
string[] |
['card'] |
Payment channels |
deepLinkHosts |
(string | RegExp)[] |
[] |
Extra hosts to hand off to the OS instead of loading in the WebView (see Deep linking) |
debug |
boolean |
false |
Show debug logs |
onGlobalSuccess |
func |
— | Called on all successful transactions |
onGlobalCancel |
func |
— | Called on all cancelled transactions |
popup.checkout() / popup.newTransaction()| Param | Type | Required | Description |
|---|---|---|---|
email |
string |
✅ | Customer email |
amount |
number |
✅ | Amount in Naira (not kobo) |
reference |
string |
— | Custom reference (optional) |
metadata |
object |
— | Custom fields / additional info |
plan |
string |
— | Paystack plan code (for subscriptions) |
invoice_limit |
number |
— | Max charges during subscription |
subaccount |
string |
— | Subaccount code for split payment |
split_code |
string |
— | Multi-split identifier |
split |
object |
— | Dynamic split object |
onSuccess |
(res) => void |
✅ | Called on successful payment |
onCancel |
() => void |
✅ | Called on cancellation |
onLoad |
(res) => void |
— | Triggered when transaction view loads |
onError |
(err) => void |
— | Triggered on WebView or script error |
| Name | Description | Required? | Default Value |
|---|---|---|---|
cart_id |
A unique identifier for the cart. Can be either a string or a number. | NO |
undefined |
custom_fields |
An array of custom fields for adding additional metadata to the transaction. If not passed, a default custom field is created using the firstName, lastName, and billingName. |
NO |
[{ display_name: '${firstName + ' ' + lastName}', variable_name: '${billingName}', value: '' }] |
cancel_action |
A string specifying the action to take if a transaction is canceled. | NO |
undefined |
custom_filters |
Custom filters to restrict or specify transaction options, such as: | NO |
undefined |
- recurring: A boolean to indicate if the transaction is recurring. |
|||
- banks: An array of bank codes for supported banks. |
|||
- card_brands: Supported card brands, e.g., 'verve', 'visa', 'mastercard'. |
|||
- supported_mobile_money_providers: Supported mobile money providers, e.g., 'mtn', 'atl', 'vod'. |
| Name | use/description | required? |
|---|---|---|
type |
Dynamic Multi-Split type. Value can be flat or percentage |
YES |
bearer_type |
Defines who bears the charges. Value can be all, all-proportional, account or subaccount |
YES |
subaccounts |
An array of subaccount object as defined below. e.g. {"subaccount": 'ACCT_xxxxxx', "share": 60} | YES |
bearer_subaccount |
Subaccount code of the bearerof the transaction. It should be specified if bearer_type is subaccount |
NO |
reference |
Unique reference of the split. Can be defined by the user | NO |
| Name | use/description | required? |
|---|---|---|
subaccount |
Specify subaccount code generated from the Paystack Dashboard or API to enable Split Payment on the transaction. Here's an example of usage: subaccount: "SUB_ACCOUNTCODE" |
YES |
share |
Defines the amount in percentage (integer) or value (decimal allowed) depending on the type of multi-split defined |
YES |
Some payment channels need to hand off to a partner app. For example, the Zap channel renders a universal link to https://joinzap.com/app/... that should open the Zap app.
WKWebView on iOS does not perform universal-link handoff or custom-scheme dispatch for navigations that originate inside the WebView, so tapping such a link would otherwise just load it as a web page. To fix this, the provider intercepts these navigations and forwards them to the OS via Linking.openURL, which triggers the universal-link handoff (iOS) or App Links / `Int
暂无开放 Issues,或尚未同步最近议题。