# Quote a crypto payment

Quote a crypto payment

`GET https://api.cadmospay.com/app/v1/gateway/checkout/{token}/quote`

For a fixed-price order, pass the chain and coin from one current cryptoRoutes entry. Display its depositAddress and the returned payAmount together. Refresh when the route or remaining amount changes. An open-amount link needs no quote. The quote route allows 20 requests per minute per IP.

## Authentication

This endpoint accepts requests without a bearer token.

## Example requests

```bash
curl --fail-with-body "https://api.cadmospay.com/app/v1/gateway/checkout/${CHECKOUT_TOKEN:?Set CHECKOUT_TOKEN}/quote" \
  --get \
  --data-urlencode "chain=ARBITRUM" \
  --data-urlencode "coin=USDC"
```

```javascript
const { CHECKOUT_TOKEN } = process.env;
if (!CHECKOUT_TOKEN) {
  throw new Error("Set CHECKOUT_TOKEN");
}

const url = new URL("https://api.cadmospay.com/app/v1/gateway/checkout/{token}/quote".replace("{token}", encodeURIComponent(CHECKOUT_TOKEN)));
url.searchParams.set("chain", "ARBITRUM");
url.searchParams.set("coin", "USDC");
const response = await fetch(url, {
  method: "GET",
  redirect: "error",
});
console.log(response.status, await response.json());
```

```python
from http.client import HTTPSConnection
from urllib.parse import urlencode
import os

conn = HTTPSConnection("api.cadmospay.com", timeout=30)
path = f"/app/v1/gateway/checkout/{os.environ['CHECKOUT_TOKEN']}/quote"
path += "?" + urlencode({"chain": "ARBITRUM", "coin": "USDC"})
conn.request("GET", path)
response = conn.getresponse()
print(response.status, response.read().decode())
conn.close()
```

## Parameters

- `token` (string, path, required, pattern ^[A-Za-z0-9_-]{43}$). Checkout secret returned as token by createLink.
- `chain` (string, query, required). Network identifier from the selected route.
- `coin` (string, query, required, one of USDC, USDT). 

## Responses

### 200

Amount of the selected coin to send for the current outstanding balance.

[CheckoutQuote](https://cadmospay.com/developers/schemas/checkout-quote.md)

```json
{
  "coin": "USDT",
  "payAmount": "100.00",
  "usdcFeeUsd": null,
  "usdcPrice": null,
  "networkFeeUsd": null,
  "minimumUsd": null
}
```

### 404

The link or selected route is unavailable. Refresh the instructions.

[Error](https://cadmospay.com/developers/schemas/error.md)

### 409

GATEWAY_NOTHING_DUE. The amount is open or the fixed order is paid.

[Error](https://cadmospay.com/developers/schemas/error.md)

### 410

GATEWAY_LINK_EXPIRED or GATEWAY_LINK_CLOSED. Stop displaying all instructions.

[Error](https://cadmospay.com/developers/schemas/error.md)

### 429

Over a limit. Wait and retry.

[Error](https://cadmospay.com/developers/schemas/error.md)

### 503

A Cadmos service failed or did not answer (`{ "message": "Service Error" }`). Retry; retry a create with the same `requestId`.

[Error](https://cadmospay.com/developers/schemas/error.md)
