razorpay / razorpay-node

Razorpay node.js bindings
MIT License
182 stars 111 forks source link

Getting razorpay_signature as undefined after successfull payment in Reactjs #347

Closed acquarapooja closed 1 year ago

acquarapooja commented 1 year ago
    const options = {
        key: RazorPayDetails.key,
        currency: RazorPayDetails.currency,
        amount: RazorPayDetails.amountInSubUnits,
        name: RazorPayDetails.name,
        description: RazorPayDetails.description,
        image:'/HRMusterLogo.png',
        orderId : RazorPayDetails.orderId,
        profileName : RazorPayDetails.profileName,
        profileContact : RazorPayDetails.profileContact,
        profileEmail : RazorPayDetails.profileEmail,
        handler : async (response) => {
            console.log("Payment Response ",response);

          console.log("Payment ID: ",response.razorpay_payment_id);
          console.log("Order ID: ",RazorPayDetails.orderId);
          console.log("Signature: ",response.razorpay_signature);

            alert("Payment ID: " + response.razorpay_payment_id);
            alert("Order Id: " + RazorPayDetails.orderId);
            alert("Signature: " + response.razorpay_signature)
            alert('Payment Successfull')

            if (response.razorpay_payment_id) {
               // if successfull payment action 

            }
        },
    };

    console.log("Options",options);
    const paymentObject = new window.Razorpay(options)

    paymentObject.on('payment.failed', function (response){
        alert(response.error.code);
        alert(response.error.description);
        alert(response.error.source);
        alert(response.error.step);
        alert(response.error.reason);
        alert(response.error.metadata.order_id);
        alert(response.error.metadata.payment_id);
    })

    paymentObject.open()
ankitdas13 commented 1 year ago

@acquarapooja According to your frontend code, you did not add callback_url , it might be possible that's why you are not getting response , could you please add that and check once?

Please check this doc for more detail. Also, this issue is not releated to this repo

ankitdas13 commented 1 year ago

@acquarapooja could you please let us know if it resolved?

Karishma1510 commented 6 months ago

Getting the same issues. Only razorpay_payment_id is available. If we need to define callback_url, why do you even have handler option in your documentation?