New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I/chromium(13226): [INFO:CONSOLE(1)] "Uncaught TypeError: window.getDeviceDetails is not a function" I/flutter (13226): Payment Error : 1 {"code":"BAD_REQUEST_ERROR","description":"The id provided does not exist","source":null,"step":null,"reason":null,"metadata":{}} #98
Comments
Please make sure the order id must have been generated using the same key id you are using to create the payment request. |
keyId is same |
What do you mean?? @ambujap94 I thought that you could use any type of orderID and it didn't have to be generated using the key or the payment ID!! I thought that if I had key as rzp_test_CphmkEBGNw9BME, the payment ID as pay_054540g48g5 and the order ID any anything for example, OR547 it would be fine!! If not, please help me in generating a proper orderID. I am using flutter and the Razorpay documentation only specified the process for generating orderID using the Orders API by using languages like JAVA, NODEJS, etc... Please guide me how to generate a valid orderID using Flutter. |
The integration step would be to generate the order id on the server using your API key and then pass the same to the checkout options to proceed with the payment. please follow steps 6 and 7 on the documentation. Please find the orders API for further reference. |
What if I don't have a dedicated backend? I don't have a backend server to " generate the order id on my server using my API key"!! |
@varamsky In the Razorpay docs, you can find APIs to create the order_id. Now,this is an API which can be called from your backend server, or this can be called directly from your application itself. Its upto you. We usually prefer doing this on the server as the keys will be safe, but if that's not an option it can be created like this as well. Just ensure you have the keys safe so that it won't be accessible elsewhere. Once you create the order_id with the key you are using to initialize checkout, it should start working. Let us know if you need any more assistance on this. Thanks, |
Thank you very much for your help @ambujap94 and @vivekshindhe . I was able to solve the issue. For anyone who is not able to solve it yet, please read the Razorpay documentation as they are guiding developers to switch to the Orders API for generating their Order IDs. Please refer to this Razorpay documentation. From what I have learned from it, you cannot generate a random Order ID (like "#ORD1") as per your convenience. You have to let Razorpay generate an Order ID for you by sending a request to them, something like this,
I created a separate method to generate an Order ID for my application. Here it is,
|
I am closing the issue for now :) |
@varamsky's method works perfectly, this is worth documenting. To return the favour, I have written the method to verify the hmac sha256 signature if anyone would want to use that too. Inside your Make sure to: void _handlePaymentSuccess(PaymentSuccessResponse response) {
final key = utf8.encode('<YOUR_KEY>');
final bytes = utf8.encode('$orderId|${response.paymentId}');
final hmacSha256 = Hmac(sha256, key);
final Digest generatedSignature = hmacSha256.convert(bytes);
if (generatedSignature.toString() == response.signature) {
print("Payment was successful!");
//Proceed further to handle events for a successful payment.
} else {
print("Payment was unauthentic!");
}
} |
5\android\src\main\kotlin\com\razorpay\razorpay_flutter\RazorpayFlutterPlugin.kt. This is likely to due to an incorrect |
I get the following error while using razorpay-flutter plugin for my flutter app:
I/chromium(13226): [INFO:CONSOLE(1)] "Uncaught TypeError: window.getDeviceDetails is not a function", source: https://api.razorpay.com/v1/checkout/public?version=1.5.16&platform=android&library=checkoutjs (1)
I/flutter (13226): Payment Error : 1 {"code":"BAD_REQUEST_ERROR","description":"The id provided does not exist","source":null,"step":null,"reason":null,"metadata":{}}
Description
Below is my complete Razorpay related code:
Please note that if I remove the order ID from the options map below then it works fine, i.e., if I remove
'order_id': 'order_EMBFqjDHEEn80l',
from the code given below then it works fine.
Flutter Version :
My
flutter doctor -v
result:This is my complete response when I run the app
Expected Results
I expect it to successfully complete the payment process and return the correct payment ID and Order ID.
The text was updated successfully, but these errors were encountered: