# Quotes

A quote locks in the terms of a transfer for a fixed period from creation. Use the returned quote `id` when creating a payin or payout to guarantee the quoted terms.

The `POST /quotes` endpoint prices both payouts and payins.

## Why use quotes

The primary purpose of a quote is to **lock in pricing before funds move**. A quote freezes the terms of a transfer at the moment it is generated, and those terms stay guaranteed until the quote's `expires_at`. Binding a quote to a payin or payout guarantees that the FX rate, fees, payment method and amounts shown to you are exactly what will be applied at execution — no surprises between pricing and settlement.

A quote locks the following until it expires:

- **FX rate** (`fx_rate`) — the exchange rate for the currency pair is fixed; it will not drift with the market.
- **Payment method** (`payment_method`) — the `type`, `subtype` and derived `rail` are pinned to the quoted option.
- **Pricing** — the `source_amount`, `destination_amount` and the full `fees` breakdown (`txn_fee`, `fx_fee`, and `referral_fee` for payins) are fixed.


Without a quote, these terms are computed at request time and can vary with live market rates. By passing the quote `id` as `quote_id` when initiating the movement of funds:

- **Payins (payment links and orders)** — the locked rate, fees and payment method are what the customer sees on the checkout page.
- **Payouts** — the locked rate, fees and payment method are what is applied to the payout at execution.


A quote is valid only until its `expires_at` (shown in the response). Once it expires or has already been consumed, you must mint a fresh quote.

## How quotes work

1. **Request a quote** — Provide the `resource` (`payout`), the currency pair, an amount, and a `payment_method`. Specify either the source amount or destination amount (not both).
2. **Review available options** — For a payout, `local_transfer` to an INR destination returns one quote per rail (`upi`, `imps`, `neft`, `rtgs`); `swift_transfer` returns a single SWIFT quote. Each quote in the response carries its own `payment_method.rail`.
3. **Use the quote** — Provide the quote `id` as `quote_id` in the relevant request: payins (payment links and orders) and payouts.


## Key details

| Detail | Value |
|  --- | --- |
| **Quote validity** | A fixed period from creation |
| **Resource** | `payout` or `payin` |
| **Amount specification** | Either `source_amount` or `destination_amount`, not both |
| **Amounts format** | In cents |
| **Payment method** | `bank_transfer` or `pay_via_bank` (`pay_via_bank` supports only `local_transfer`) |
| **Subtype** | `local_transfer` or `swift_transfer` |
| **Payment rails (derived)** | `upi`, `imps`, `neft`, `rtgs`, `swift` |


## Example request

```bash
curl -X POST https://api.glomopay.com/api/v1/quotes \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "resource": "payout",
    "source_currency": "USD",
    "destination_currency": "INR",
    "source_amount": 10000,
    "payment_method": {
      "type": "bank_transfer",
      "subtype": "swift_transfer"
    }
  }'
```

## Example response

```json
{
  "quotes": [
    {
      "id": "quote_3m4n5o6p7q",
      "resource": "payout",
      "expires_at": "2026-06-12T08:16:50Z",
      "payment_method": {
        "type": "bank_transfer",
        "subtype": "swift_transfer",
        "rail": "swift"
      },
      "source_currency": "USD",
      "destination_currency": "INR",
      "fx_rate": 90.0,
      "source_amount": 10000,
      "destination_amount": 882000,
      "fees": {
        "txn_fee": {
          "currency": "USD",
          "amount": 100
        },
        "fx_fee": {
          "currency": "USD",
          "amount": 100
        }
      }
    }
  ]
}
```

## Fees breakdown

Each quote includes a detailed fee breakdown:

- **Transaction fee (`txn_fee`)** — Fixed fee charged per transaction.
- **FX fee (`fx_fee`)** — Fee applied on top of the exchange rate for currency conversion.
- **Referral fee (`referral_fee`)** — Payin only; present when a referral `price_id` was applied.


All fees are expressed in the smallest unit of the fee currency.