Flutterwave Android付款集成-无法处理付款-错误无法检索交易费用

时间:2019-07-30 13:18:05

标签: android payment flutterwave

我第一次使用Rave,它看起来如此灵活且易于集成,但一直沿用。我受困于测试,只使用卡和银行付款方式。

  1. 当我选择卡片并从测试卡链接https://developer.flutterwave.com/reference#test-cards-1输入一些测试卡时 我遇到2个错误,=>“无法取回交易费”,但在我的logcat中看到=>“仅允许使用测试卡ree”。而且我还处于暂存模式,我认为在使用测试键进行测试时是正确的。

  2. 当我使用“银行”标签时,在JSON中有一些错误,但是稍后显示=>“未定义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中的金额和返回状态中设置的值进行付款,在这里我可以检查并为用户提供价值

1 个答案:

答案 0 :(得分:0)

首先请确保您使用的是用于测试的api键,如果您处于登台模式(测试),则将其设置为true。 onStagingEnv(true)并在此之后进行测试。