> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-881012b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Payment Link/Invoices Callback Support

<div style={{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.35rem 0.9rem",border:"1px solid rgba(128,128,128,0.28)",borderRadius:"0.5rem",padding:"0.45rem 0.75rem",margin:"0 0 1.25rem",fontSize:"0.875rem"}}>
  <span style={{fontWeight:600}}>Available in</span>
  <span>🇮🇳 India</span>
</div>

## Creation

Two extra parameters need to be sent in the Create [Payment Link](/docs/api/payments/payment-links)/ [Invoices](/docs/api/payments/invoices) API:

`callback_url​` string
: URL hosted on your server where the user is redirected to after a successful payment.

`callback_method` string
: HTTP 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.

## Callback parameters

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

| Parameter                  | Description                                                                                                                              |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `razorpay_payment_id`      | razorpay\_payment\_idPayment ID of the successful payment.                                                                               |
| `razorpay_invoice_id`      | Invoice ID generated when the payment link was created.                                                                                  |
| `razorpay_invoice_receipt` | Perpule’s order ID, if set during the payment link create request. Empty if not set.                                                     |
| `razorpay_invoice_status`  | Current status of the payment link invoice.                                                                                              |
| `razorpay_signature`       | Signature for backend validation, to be calculated as HMAC hex digest using SHA256 algorithm. This is described below with a pseudocode. |

## Signature Verification

* 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**:

```python sample.py theme={null}
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
}
```
