npm i --save nativescript-rave
- 版本:1.2.0
- GitHub: https://github.com/MohammedBashiru/nativescript-rave
- NPM: https://npmjs.net.cn/package/nativescript-rave
- 下载量
- 昨天:0
- 上周:1
- 上个月:3
Rave-Nativescript
版本 1.2.0
- 升级到 nativescript 6
- 修复了提取交易费的问题
- 旧版本仓库链接 https://github.com/MohammedBashiru/rave-nativescript
版本 1.1.0
- 升级到 rave-android:1.0.43
- 修复了一些已注意到的错误
版本 1.0.0
- 使用 rave-android:1.0.39
- 首次发布
此插件允许您在 Nativescript 中使用 flutterwave 支付平台。有关更多信息,请访问 https://developer.flutterwave.com
需求
-
添加所需权限
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
所需权限
此库需要 READ_PHONE_PERMISSION 以获取构建号以进行欺诈检测并标记,如以下链接中建议:https://developer.android.com.cn/training/articles/user-data-ids.html#i_abuse_detection_detecting_high_value_stolen_credentials
安装
tns plugin add rave-nativescript
用法
探索插件用法的最佳方式是检查插件仓库中的演示应用程序。在 demo
文件夹中,您可以找到插件的用法。
除了插件用法之外,这两个应用程序都进行了 webpack 配置。
简而言之,以下是步骤
导入插件
TypeScript import * as RaveNativescript from 'rave-nativescript';
JavaScript var Expresspay = require("rave-nativescript");
启动 RavePayManager
let context = RaveNativescript.prepare({
country: "country",
currency: "currency here",
fName: "Customer first name",
lName: "Customer last name",
email: "customer email",
narration: "Your narration here",
publicKey: "your public key here",
encryptionKey: "your encryption key here",
txRef: "txRef",
amount: amount,
acceptAccountPayments: true,
acceptCardPayments: true,
acceptGHMobileMoneyPayments: true,
onStagingEnv: true,
shouldDisplayFee: true,
showStagingLabel: false,
setSubAccounts: [{
subAccountId : "subAccountId",
transactionSplitRatio: 1
}],
setMeta: [{ metaname: "Meta name here", metavalue: "meta value here"}]
});
完整用法
context.checkoutPayment()
.then((response) => {
console.log("payment process complete")
console.log(response)
})
.catch(e => {
console.log("handle errors")
})
API
方法
选项 | 状态 | 默认 | 描述 |
---|---|---|---|
amount | 必需 | null | 这是从卡/账户中收取的金额 |
country | 必需 | null | 这是与货币相关的交易路由国家。您可以在以下链接中找到支持的国家和货币列表 这里 |
currency | 必需 | null | 这是指定用于向卡收取的货币 |
fName | 必需 | null | 这是持卡人或客户的第一个名字 |
lName | 必需 | null | 这是持卡人或客户的姓氏 |
必需 | null | 这是客户的电子邮件地址 | |
narration | 可选 | null | 这是商家添加的自定义描述。对于银行转账支付,这成为要支付的账户的账户名。更多详细信息请参阅 这里 |
publicKey | 必需 | null | 商家的公钥。在此处获取 预发布 和 生产 的商家密钥 |
encryptionKey | 必需 | null | 商家的加密密钥。在此处获取 预发布 和 生产 的商家密钥 |
txRef | 必需 | null | 这是唯一的参考,对于正在进行的特定交易是唯一的。它由商家为每笔交易生成 |
acceptAccountPayments(boolean) | 可选 | false | 如果您想通过卡片接受支付,请将其设置为 true ,否则请设置为 false |
acceptCardPayments(boolean) | 可选 | false | 如果您想通过卡片接受支付,请将其设置为 true ,否则请设置为 false |
acceptMpesaPayments(boolean) | 可选 | false | 设置为 true 以接受 Mpesa 付款,否则设置为 false 。为此选项生效,您应将国家设置为 KE ,货币设置为 KES |
acceptGHMobileMoneyPayments(boolean) | 可选 | false | 设置为 true 以接受加纳移动货币付款,否则设置为 false 。为此选项生效,您应将国家设置为 GH ,货币设置为 GHS |
acceptUgMobileMoneyPayments(boolean) | 可选 | false | 设置为 true 以接受乌干达移动货币付款,否则设置为 false 。为此选项生效,您应将国家设置为 UG ,货币设置为 UGX |
acceptAchPayments(boolean) | 可选 | false | 设置为 true 以接受来自客户的美国 ACH 收费,否则设置为 false 。为此选项生效,您应将国家设置为 US ,货币设置为 USD 。您还必须设置 acceptAccountPayments(true) |
acceptBankTransferPayments(boolean) | 可选 | false | 设置为 true 以接受客户通过银行转账的付款,否则设置为 false。此选项目前仅适用于尼日利亚奈拉。更多详情请参阅 API 位置 |
onStagingEnv(boolean) | 必需 | false | 如果希望您的交易在测试环境中运行,则设置为 true ,否则设置为 false 。默认为 false |
txRef | 必需 | null | 传递您希望传递的任何其他自定义数据。它接受一个 Meta 对象 {} 的数组 |
txRef | 必需 | null | 这是唯一的参考,对于正在进行的特定交易是唯一的。它由商家为每笔交易生成 |
贡献
我们热爱 Pull Requests!如果您想贡献,但不确定从何开始,请寻找标记为 help wanted 的 issue。
获取帮助
请仅使用 github issues 报告错误或请求功能。