> For the complete documentation index, see [llms.txt](https://ninjapay.gitbook.io/ninjapay-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ninjapay.gitbook.io/ninjapay-api-docs/fiat-x-web3-bridge/get-started/request-invoice-for-quote.md).

# Request Invoice for Quote

Request a Lightning Network invoice from the UPI provider. The web app provides the payment amount either in satoshis or in INR, and the function returns a BOLT-11 invoice. The function could also optionally provide a price quote in INR.

#### Method

```
POST https://prod.ninjapay.me/sapi/v1/requestQuote
```

#### Parameters

```jsx

{
  quote_id: string; // The quote ID obtained from the requestQuoteID() method.
  callback_url?: string // Add webhook to get response on successful payment.
}

```

#### Response

```json

{
  "tid": int, // The transaction id of this quote
  "sending_asset": string; // "btc" or "usdt" for btc/usdt to inr conversion.
  "sending_asset_amount": int; // The amount to pay for fiat conversion.
  "fiat_amount": int; // The fiat amount that the upi id will receive.
  "lightning_invoice": string, // The Lightning invoice to pay.
  "onchain_address": string, // The on-chain address to pay if lightning payment not possible..
  "onchain_address_network": string, // BTC, ERC20, BEP20...
  "expires_at": int, // The expiry time for the payment quote.
  "callback_url": string // The webhook url to get response on successful payment.
  "receiver_upi_id": string, // The UPI ID to which the fiat amount will be sent.
  "receiver_ninjatag": string // The Ninjatag of the recipient you want quote for.
}

```

<mark style="background-color:red;">**Note**</mark>: After the Lightning invoice payment, in case the UPI payment transfer fails, the BTC funds will be sent back to the merchant wallet mentioned during the [Quote ID request](/ninjapay-api-docs/fiat-x-web3-bridge/get-started/request-quote-id-btc-less-than-greater-than-inr.md#parameters).

### Payment Success Response

Upon successful payment, the Ninjapay platform sends the fiat amount to the provided UPI ID and gives a success response to the **callback\_url**.

#### Response

```json

{
  "tid": int, // The transaction ID for the successful payment.
  "status": string // you get "success" 
  "receiver_upi_id": string, // The UPI ID to which the fiat amount was sent.
}

```

#### Code Example

```jsx

const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'API_KEY'
  },
  body: '{""quote_id":"aa1728acff604222a96d1343f9246c12","callback_url":"https://yourwebhook.com"}'
};

fetch('https://prod.ninjapay.me/sapi/v1/requestQuote', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  
```

In this version of the function, the amount to be paid can only be specified in INR. The Ninjapay exchange provider will then generate a Lightning Network invoice quote for that amount. The specifics of the implementation would again depend on the particular Business and the exchange rate used.
