# Get payment options

> Read whether the diner can pay with Tamr Pay here, the providers, limits and tip presets.

Source: https://tamr.link/docs/api/get-pay-options

`GET https://tamr.link/api/v1/pay/options`

Whether the diner can pay with Tamr Pay at this branch and table, which providers, their limits and the tip presets. With `orderId`, the options for paying that pickup ahead.

With `orderId`, the options for paying that pickup ahead, at its own location and menu.

## Authentication

**Client API.** Send your publishable key in `x-tamr-key` and the diner's session in `x-tamr-session`, from [Start a session](https://tamr.link/docs/api/start-session). For a guest's session, also send its device id in `x-tamr-device`. A browser may call it only from an origin listed on the key.

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `branch` | string | No | An address: lower-case letters, digits and dashes. |
| `orderId` | string | No | 1 to 200 characters. |

## Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-tamr-device` | string | No | Guest sessions only: the device id the session was exchanged with. Matches `^[A-Za-z0-9_-]{8,128}$`. |
| `x-tamr-app` | string | No | Native apps only: the app's iOS bundle id or Android package name. A key used from an app it doesn't list is logged, never refused. Matches `^[A-Za-z][A-Za-z0-9_-]*(\.[A-Za-z0-9_-]+)+$`. |

## Response

| Field | Type | Description |
| --- | --- | --- |
| `available` | boolean |  |
| `reason` | string or null | One of `not_enabled`, `paused`, `no_provider`, `provider_not_available`, `test_key`, `orders_to_app`, `invalid_amount`, `below_minimum`, `above_maximum`, `tip_too_large`, `tips_off`, `daily_cap`, `wallet_full`, `monthly_cap`, `payment_in_progress`, `already_paid`, `provider_unavailable`, `provider_error`, `table_already_paid`, `tab_not_found`, `typed_amount_off`, `tab_nothing_owed`, `tab_amount_over`, `tab_changed`, `other`. An open list: read a value you don't know as `other`. |
| `currency` | string or null | A three-letter currency code (ISO 4217). |
| `exponent` | integer or null | 0 to 4. |
| `providers` | array of object | At most 8 items. |
| `providers[].id` | string | 1 to 40 characters. |
| `providers[].name` | string | 1 to 80 characters. |
| `providers[].merchantName` | string | 1 to 200 characters. |
| `providers[].min` | string | An amount in minor units, as a string. |
| `providers[].max` | string | An amount in minor units, as a string. |
| `tipPresets` | array of integer or null | At most 6 items. 0 to 10,000. |
| `typedAmount` | string or null | One of `allowed`, `off`, `against_tab`, `unknown`. An open list: read a value you don't know as `unknown`. |
| `tab` | object or null |  |
| `tab.table` | string | 1 to 40 characters. |
| `tab.amount` | string | An amount in minor units, as a string. |
| `openPayment` | object or null |  |
| `openPayment.paymentId` | string | 1 to 200 characters. |
| `openPayment.reference` | string | 1 to 40 characters. |
| `openPayment.status` | string | One of `open`, `paid`, `failed`, `expired`, `refunded`, `unknown`. An open list: read a value you don't know as `unknown`. |
| `openPayment.amount` | string | An amount in minor units, as a string. |
| `openPayment.tip` | string | An amount in minor units, as a string. |
| `openPayment.total` | string | An amount in minor units, as a string. |
| `openPayment.currency` | string | A three-letter currency code (ISO 4217). |
| `openPayment.expiresAt` | string (date-time) or null |  |
| `openPayment.provider` | string | May be absent. 1 to 40 characters. |
| `openPayment.pay` | string | May be absent. One of `tab`, `amount`, `order`, `unknown`. An open list: read a value you don't know as `unknown`. |

## Example

curl:

```bash
curl "https://tamr.link/api/v1/pay/options?branch=achrafieh" \
  -H "x-tamr-key: $TAMR_APP_KEY" \
  -H "x-tamr-session: $TAMR_SESSION"
```

Node:

```js
import { createClient } from "@tamr/api";

const tamr = createClient({ appKey: process.env.TAMR_APP_KEY });
// Sign the diner in first, with a token your backend signed (or a launch code).
await tamr.startSession({ token: dinerToken });

const result = await tamr.payOptions({ branch: "achrafieh" });
console.log(result);
```

Python:

```python
import os

import requests

API = "https://tamr.link/api/v1"
headers = {
    "x-tamr-key": os.environ["TAMR_APP_KEY"],
    "x-tamr-session": os.environ["TAMR_SESSION"],  # from POST /api/v1/sdk/session
}

response = requests.get(
    f"{API}/pay/options",
    headers=headers,
    params={"branch": "achrafieh"},
    timeout=30,
)
response.raise_for_status()
print(response.json())
```

## Example response

```json
{
  "available": true,
  "reason": null,
  "currency": "USD",
  "exponent": 2,
  "providers": [
    {
      "id": "whish",
      "name": "Whish",
      "merchantName": "Abiroot S.A.R.L. (Tamr)",
      "min": "100",
      "max": "50000"
    }
  ],
  "tipPresets": [
    1000,
    1500,
    2000
  ],
  "typedAmount": "allowed",
  "tab": {
    "table": "12",
    "amount": "2400"
  },
  "openPayment": null
}
```

## Errors

Every error has the same body; switch on `data.code`. See [Errors and rate limits](https://tamr.link/docs/errors).

| `data.code` | Status | What to do |
| --- | --- | --- |
| `app_key_invalid` | 401 | The key is wrong, revoked or of another kind. Check it in the dashboard. |
| `sdk_disabled` | 403 | The SDK isn't switched on for this restaurant. Ask Tamr. |
| `origin_not_allowed` | 403 | A browser called from an origin the key doesn't list. Add the origin to the key. |
| `session_expired` | 401 | Start a new session with a fresh token or code, then send the call again once. |
| `invalid_request` | 400 | A field doesn't match the spec. The message says which. |
| `rate_limited` | 429 | Wait `retryAfter` seconds (also in the `Retry-After` header), then try again. |
