0

我在我的 android 应用程序中使用razorpay支付网关。我从服务器获取我的orderid并将其存储在 JSON 对象中。将值放入 JSON 对象后,我调用支付网关函数。问题是网关返回错误,因为orderid无效。假设我的orderid如下:order_ABC8324kbsjdf。当我在将orderid添加到 JSON 对象之前记录它的格式是正确的,但是当我记录响应时,我发现 a\附加到orderidorder删除了部分。有什么办法可以解决吗?

final Checkout co = new Checkout();
    try {
        JSONObject options = new JSONObject();
        options.put("key","rzp_test_HxDYx5i6JW1Ujd");
        options.put("name", "Commission Calculator");
        options.put("description", "Buy serial key");
        //You can omit the image option to fetch the image from dashboard
        options.put("image", "https://rzp-mobile.s3.amazonaws.com/images/rzp.png");
        //order_id=order_id.replace("\\\\","");
        Log.d("ORDER",order_id);

        options.put("order_id",order_id);
        options.put("currency", "INR");

        String payment = editTextPayment.getText().toString();

        double total = Double.parseDouble(payment);
        total = total * 100;
        options.put("amount", total);

        JSONObject preFill = new JSONObject();
        preFill.put("email", "sikander@gkmit.co");
        preFill.put("contact", "9680224241");

        options.put("prefill", preFill);

        co.open(activity, options);
    } catch (Exception e) {
        Toast.makeText(activity, "Error in payment: " + e.getMessage(), Toast.LENGTH_SHORT).show();
        e.printStackTrace();
    }

订单 ID 日志

响应日志

4

0 回答 0