I need to send the input parameters in the POST method to the payment gateway along with the callback URL. But not understanding what should be the callback URL here.
<form method="POST" action="https://api.razorpay.com/v1/checkout/embedded">
<input type="hidden" name="key_id" value="YOUR_KEY_ID">
<input type="hidden" name="order_id" value="razorpay_order_id">
<input type="hidden" name="name" value="Acme Corp">
<input type="hidden" name="description" value="A Wild Sheep Chase">
<input type="hidden" name="image" value="https://cdn.razorpay.com/logos/BUVwvgaqVByGp2_large.png">
<input type="hidden" name="prefill[name]" value="Gaurav Kumar">
<input type="hidden" name="prefill[contact]" value="9123456780">
<input type="hidden" name="prefill[email]" value="gaurav.kumar@example.com">
<input type="hidden" name="notes[shipping address]" value="L-16, The Business Centre, 61 Wellfield Road, New Delhi - 110001">
<input type="hidden" name="callback_url" value="https://example.com/payment-callback">
<input type="hidden" name="cancel_url" value="https://example.com/payment-cancel">
<button>Submit</button>
</form>
Once the payment is done, the payment gateway will return the response like payment id, signature, order id, etc. Based on this I need to validate the response at our end and redirect to respective pages like success in case of payment success and cart page in case of any error. I had written the code in the Model directory to validate the signature. So my question is how to handle it? how to redirect to a success page once the payment is done.
You should create a custom controller for success and for fail .In your controllers you should implement the code for validations ,when you are finished with the checks you should redirect in magento (success or fail page).
So on callback_url and on cancel_url you should have the urls from your controllers.