【发布时间】:2019-12-07 21:46:23
【问题描述】:
我是第一次使用 Rave,它看起来很灵活,也更容易集成,但是顺其自然。我无法进行测试,我只使用信用卡和银行付款方式。
当我从测试卡链接https://developer.flutterwave.com/reference#test-cards-1选择卡并输入一些测试卡时 我收到 2 个错误,=>“无法检索交易费用”,但在我的
logcat中,我看到 =>“只允许测试卡ree”,其中正在使用测试卡。而且我还处于暂存模式,我认为在使用测试密钥进行测试时是正确的。当我使用银行选项卡时,
JSONtoasted 出现一些错误,但稍后显示 =>“parents_limit 未定义”。不仅我给出了这个错误,我还发现我的仪表板上记录了银行支付类型的交易。这让我更加困惑,因为我没有收到付款成功消息,因此我可以验证并为客户提供价值。
我已按照 Rave 文档中的指南整合了所有内容,这称为我的付款。来自https://github.com/Flutterwave/rave-android
实现变量
//online payment
String[] fullname;
String email = "";
String fName = "";
String lName = "";
String narration = "Payment for Riidit App activation";
String txRef;
String country = "NG";
String currency = "NGN";
private String mUsername, userID, mEmail;
付款方式
private void makePayment(int amount) {
txRef = email + " " + UUID.randomUUID().toString();
try {
fullname = mUsername.split(" ");
fName = fullname[0];
lName = fullname[1];
} catch (NullPointerException ex) {
ex.printStackTrace();
}
/*
Create instance of RavePayManager
*/
new RavePayManager(this).setAmount(amount)
.setCountry(country)
.setCurrency(currency)
.setEmail(email)
.setfName(fName)
.setlName(lName)
.setNarration(narration)
.setPublicKey(RiiditUtilTool.getPublicKey())
.setEncryptionKey(RiiditUtilTool.getEncryptionKey())
.setTxRef(txRef)
.acceptAccountPayments(true)
.acceptCardPayments(true)
.acceptMpesaPayments(false)
.acceptGHMobileMoneyPayments(false)
.onStagingEnv(false)
.allowSaveCardFeature(true)
.withTheme(R.style.DefaultTheme)
.initialize();
}
//从下面调用
private void payOnline()
{
makePayment(amount);
}
public void onActivateOnlineClick(View v) {
payOnline();
}
//这里的支付结果期待失败或成功
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RaveConstants.RAVE_REQUEST_CODE && data != null) {
String message = data.getStringExtra("response");
if (resultCode == RavePayActivity.RESULT_SUCCESS) {
Toast.makeText(this, "SUCCESS " + message, Toast.LENGTH_LONG).show();
// get a PIN and SERIAL no when payment succeeds
getGetPinAndSerialForPaidUser();
} else if (resultCode == RavePayActivity.RESULT_ERROR) {
Toast.makeText(this, "ERROR " + message, Toast.LENGTH_LONG).show();
} else if (resultCode == RavePayActivity.RESULT_CANCELLED) {
Toast.makeText(this, "Payment CANCELLED " + message, Toast.LENGTH_LONG).show();
}
}
}
我希望当这个事件被触发时,它会使用上面onActivityResult中设置的金额和返回状态中的值进行支付,我可以在这里检查并为用户提供价值
【问题讨论】:
-
加入Flutterwave Developer Slack。您会在那里得到快速回复。
标签: android payment flutterwave