Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Razorpay response not sending Razorpay order_id

Tags:

react-native

I am working on React Native Razorpay payment gateway integration. I am using react-native-razorpay.

Code is below:-

Send Params are:-

var options = {
      description: "Credits towards consultation",
      image: "https://i.imgur.com/3g7nmJC.png",
      currency: "INR",
      key: "a-----b----ccc-dd",
      amount: Math.round(Number(order_total).toFixed(2) * 100),
      name: "Product",
      prefill: {
        email: email ? email : "[email protected]",
        contact: mobile ? mobile : "1111111111",
        name:
          firstname && lastname
            ? `${firstname} ${lastname}`
            : "Razorpay Software"
      },
      theme: { color: theme.colors.primaryColor },

      payment_capture: 1
};

Checkout Method:-

RazorpayCheckout.open(options)
.then(data => {
  // handle success
  console.log("payment success", data);
  if (data && data.razorpay_payment_id) {
    orderData.payment = data.razorpay_payment_id;
    this.props.payMyOrder(orderData);
  }
})
.catch(error => {
  // handle failure
  this.toast.show(error.description);
});

I am getting only razorpay_payment_id in response but, razorpay_payment_id and razorpay_signature are missing. Also, in Razorpay backend Razorpay Order Id and Order Id are missing.

like image 543
vikas dhiman Avatar asked Jan 27 '20 12:01

vikas dhiman


2 Answers

hey as we can see in the above code options object that you are passing to the checkout you are not passing the order_id, you should pass the order_id as well. Since you are not passing the order_id the same is not getting returned to you after the payment is done. refer to the below link on how to create an order at your server-side. https://razorpay.com/docs/api/orders/ if you pass the order_id in the request param to the checkout you'll get the order_id and signature as well in the payment response.

like image 145
Praveen Avatar answered Oct 08 '22 10:10

Praveen


Please check the documentation we need to pass the order_id, here.

As per the documentation, once you pass the order_id, then only after payment successful razorpay returns the razorpay_order_id,razorpay_payment_id and razorpay_signature.

After that you can compare the signature to get acknowledgement of payment success.

like image 43
Dnyaneshwar Suryawanshi Avatar answered Oct 08 '22 10:10

Dnyaneshwar Suryawanshi