Payment Link/Invoices Callback Support


Two extra parameters need to be sent in the Create

/ API:

callback_url​

stringURL hosted on your server where the user is redirected to after a successful payment.

callback_method

stringHTTP method for the callback request. Currently, only get is supported.

These two would not be available in API response as of now and will be exposed later.

The following query parameters are appended to the callback URL by Razorpay:

  • The invoice_id​ attribute should have been stored in your system against an order, right after it was returned in the response to create payment link/invoices API request.

  • After validating the signature, you should fetch the order in your system corresponding to the razorpay_invoice_id​ and only mark this order successful.

  • The razorpay_signature should be validated by your backend. In order to verify the signature, you need to create a signature using razorpay_invoice_id, razorpay_invoice_receipt, razorpay_invoice_status and razorpay_payment_id​ as payload and your key_secret​ (your api secret) as secret.

    Of these, razorpay_invoice_receipt, razorpay_invoice_status ​and razorpay_payment_id​ ​are sent to your as callback query parameters as described above.

Pseudocode:

expected_signature = razorpay_invoice_id + '|' +
razorpay_invoice_receipt + '|' +
razorpay_invoice_status + '|' +
razorpay_payment_id;
expected_signature = hmac_sha256(signature_payload, api_secret);
if (generated_signature == razorpay_signature​)
{
// Callback parameters are authentic
}

Was this page helpful?