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_idattribute 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_idand only mark this order successful. -
The
razorpay_signatureshould be validated by your backend. In order to verify the signature, you need to create a signature usingrazorpay_invoice_id,razorpay_invoice_receipt,razorpay_invoice_statusandrazorpay_payment_idas payload and yourkey_secret(your api secret) as secret.Of these,
razorpay_invoice_receipt,razorpay_invoice_statusandrazorpay_payment_idare 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?