razorpay / razorpay-flutter

Razorpay Flutter Plugin
MIT License
107 stars 147 forks source link

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'String' is not a subtype of type 'Map<dynamic, dynamic>?' in type cast E/flutter ( 2722): #0 PaymentFailureResponse.fromMap razorpay_flutter.dart:150 E/flutter ( 2722): #1 Razorpay._handleResult razorpay_flutter.dart:72 E/flutter ( 2722): #2 Razorpay.open #300

Open joesaniya opened 1 year ago

joesaniya commented 1 year ago

Facing issue when I am trying to launch the razorpay checkout activity using "razorpay.open(options)".its showing razorpay loading screen and closing razorpay screen immediately.

GokulakrishnanV commented 1 year ago

Same error here!

joesaniya commented 1 year ago

Same error here!

did you find any solutions?

Akshiiitsaxena commented 1 year ago

@GokulakrishnanV were you able to get any workaround?

GokulakrishnanV commented 1 year ago

@GokulakrishnanV were you able to get any workaround?

@Akshiiitsaxena It was an error on my side. Kindly double check the order I'd generated from the server. Ther order Id must be generated by razorpay's orders API (example: order_xxxxxxxxx). If that didn't work too, try making the payment without order Id. If this works, then it's a problem with the generated order Id. And also send all the mandatory params such as amount, name and so on.

rohit5krish commented 1 year ago

Facing issue when I am trying to launch the razorpay checkout activity using "razorpay.open(options)".its showing razorpay loading screen and closing razorpay screen immediately.

It's the issue with the order key in options.

Instead of order_id, try giving order. This order must be generated from backend. For testing, just give random values for temporary fix.

var options = {
        'key': '<YOUR_KEY_ID>',
        'amount': 50000, //in the smallest currency sub-unit.
        'name': 'Acme Corp.',
        'order': {
          "id": "order_DaZlswtdcn9UNV",
          "entity": "order",
          "amount": 50000,
          "amount_paid": 0,
          "amount_due": 50000,
          "currency": "INR",
          "receipt": "Receipt #20",
          "status": "created",
          "attempts": 0,
          "notes": {"key1": "value1", "key2": "value2"},
          "created_at": 1572502745
        },
        'description': 'Fine T-Shirt',
        'timeout': 60, // in seconds
        'prefill': {
          'contact': '9123456789',
          'email': 'gaurav.kumar@example.com'
        }
      };