# Discover payment methods

Discover payment methods

`GET https://api.cadmospay.com/machine/v1/gateway/methods`

Availability is scoped to your wallet and the optional order price. Specific crypto networks and assets are shown after a link is provisioned. Check availability again with requireAllLocalMethods when you promise a method.

## Authentication

`Authorization: Bearer <accessToken>`

The `accessToken` from `POST /v1/external-auth/token`, valid 15 minutes.

## Example requests

```bash
curl --fail-with-body 'https://api.cadmospay.com/machine/v1/gateway/methods' \
  -H "Authorization: Bearer ${CADMOS_ACCESS_TOKEN:?Set CADMOS_ACCESS_TOKEN}" \
  --get \
  --data-urlencode "amountUsd=100.00"
```

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

const url = new URL("https://api.cadmospay.com/machine/v1/gateway/methods");
url.searchParams.set("amountUsd", "100.00");
const response = await fetch(url, {
  method: "GET",
  redirect: "error",
  headers: {
    Authorization: "Bearer " + CADMOS_ACCESS_TOKEN,
  },
});
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 = "/machine/v1/gateway/methods"
path += "?" + urlencode({"amountUsd": "100.00"})
headers = {
    "Authorization": "Bearer " + os.environ["CADMOS_ACCESS_TOKEN"],
}
conn.request("GET", path, headers=headers)
response = conn.getresponse()
print(response.status, response.read().decode())
conn.close()
```

## Parameters

- `amountUsd` (string, query, optional, pattern ^\d{1,7}(\.\d{1,2})?$). The price in dollars, from 0.50 to 1000000, as a decimal string (`"100"`, `"99.5"`), never a JSON number. The Gateway Fee is yours: it comes out of what is counted and the payer never sees it. Absent: the payer chooses what to send.
- `routeFeePayer` (string, query, optional, one of customer, merchant). 
- `maxRouteFeeUsd` (string, query, optional, pattern ^\d{1,7}(\.\d{1,2})?$). Required per-payment sponsorship cap in USD when the merchant covers Whish fees. Other routes and wallet gas stay customer-paid.

## Responses

### 200

Discover payment methods

[PaymentMethods](https://cadmospay.com/developers/schemas/payment-methods.md)

```json
{
  "cryptoCheckout": true,
  "localMethods": [
    {
      "code": "whish",
      "name": "Whish",
      "state": "available",
      "reason": null
    }
  ]
}
```

### 401

No token, or a token that is expired or not for this route: sign in again.

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

### 403

Your identity is not allowed this route, or has no business wallet.

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

### 422

The request does not match this contract: `VALIDATION_ERROR` lists each field and the rule it broke. An amount outside $0.50 to $1,000,000 is refused here too.

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

### 429

Over a limit. Wait and retry.

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