我正在我的 flutter 应用程序中实现支付网关。所以 Razorpay 推荐我使用 Orders API。但我没有任何方法来实现 Orders API。
我参考了以下文档。它包含 java、PHP 等的示例。但没有找到 Flutter / Dart 的示例。
https://razorpay.com/docs/ payment-gateway/orders/integration/#example https://razorpay.com/docs/payment-gateway/orders/integration/#example
提前致谢。
Future<void> generate_ODID() async {
var orderOptions = {
'amount': 50000, // amount in the smallest currency unit
'currency': "INR",
'receipt': "order_rcptid_11"
};
final client = HttpClient();
final request =
await client.postUrl(Uri.parse('https://api.razorpay.com/v1/orders'));
request.headers.set(
HttpHeaders.contentTypeHeader, "application/json; charset=UTF-8");
String basicAuth = 'Basic ' +
base64Encode(utf8.encode(
'${'YourKEY'}:${'YourSECRET'}'));
request.headers.set(HttpHeaders.authorizationHeader, basicAuth);
request.add(utf8.encode(json.encode(orderOptions)));
final response = await request.close();
response.transform(utf8.decoder).listen((contents) {
print('ORDERID'+contents);
String orderId = contents.split(',')[0].split(":")[1];
orderId = orderId.substring(1, orderId.length - 1);
Fluttertoast.showToast(
msg: "ORDERID: " +orderId,
toastLength: Toast.LENGTH_SHORT);
Map<String, dynamic> checkoutOptions = {
'key': 'YourKEY',
'amount': 11100,
'name': 'Demo',
'description': 'Fssai Registrtion Charge',
'prefill': {'contact': '8910407549', 'email': '[email protected] /cdn-cgi/l/email-protection'},
'external': {
'wallets': ['paytm']
}
};
try {
_razorpay.open(checkoutOptions);
} catch (e) {
print(e.toString());
}
});
}
我正在使用相同的代码片段,但是当我尝试使用 google pay 进行付款时,它将失败,并显示“您的钱未借记,您的服务器正忙”错误,但是当我尝试手动提供 UPI Id 时,交易顺利进行,否则交易未使用 UPI 完成。有什么办法可以解决这个问题吗?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)