'getting a payment failed unexpected error in razorpay in react native ios and android

I am integrating a razorpay payment gateway in my react native app . whenever I'm trying to open a razorpay checkout UI its first open a pop up with a loader and after few secods its gives an error payment failed unexpected error with error code 1 . below is my razorpay checkout UI code

 var options = {
        description: "Credits towards consultation",
        image: "https://i.imgur.com/3g7nmJC.png",
        currency: "INR",
        key: "xxxxxxxxxxxxxxxx", 
        amount: "100", //`${amount}`,
        name: "Gulb",
        //order_id: order_id, //Replace this with an order_id created using Orders API.
      
        theme: { color: "#53a20e" },
      };
      RazorpayCheckout.open(options)
        .then(async (response) => {
          console.log("this is payment id", response);

          alert("Payment Successfull");
}.catch((error) => {
          // handle failure
          alert(`${error.description}`);
          console.log("this is ", error);
        });

also I am getting proper order_id from server and still it shows a same error

for ios it shows - payment failed unexpected error for android it shows - no appropriate payment method found



Solution 1:[1]

I also faced a similar issue while integrating razorpay on my react-native app. But I simply regenerated my key id and key secret and re-ran my app again. The issue magically disappreared.

I hope you solved your problem. But leaving this here in case someone else in the future needs any help.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lenabalakumar