我在Android应用程序中使用 razorpay 付款网关。我从服务器获取 orderid 并将其存储在JSON对象中。将值放入JSON对象后,我调用了支付网关功能。
问题在于网关由于 orderid 无效而返回错误。
假设我的 orderid 如下:order_ABC8324kbsjdf
。当我登录 orderid 并将其添加到JSON对象之前,它的格式正确,但是当我登录响应时我发现在{em> orderid 上附加了\
,并删除了order
部分。有什么办法可以解决?
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();
}