# Save payment code patterns

`PUT /service/@id/tinopay/pay-codes` · TinoPay, service owner's sign-in token

Replaces the whole list: body `{"pay_codes": [...]}` sends every existing pattern plus the new ones, `[]` removes all; at most 20 patterns. `prefix` 2–5 letters or digits (stored upper case, unique), `suffix_from` ≤ `suffix_to` within 1–30, `character_type` `NumberOnly` or `NumberAndLetter`. Returns the list after saving. Dropping a prefix a Sapo integration uses: 409 `RESOURCE_IN_USE`, `details.prefixes` lists those prefixes.

## HTTP request

| Item | Value |
| --- | --- |
| URL | `https://api.tino.vn/service/@id/tinopay/pay-codes` |
| Method | `PUT` |
| Authentication | the TinoPay service owner's sign-in token (`Authorization: Bearer <token>`); the `/v1` gateway does not expose TinoPay yet |
| Content-Type | `application/json` |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | int | yes | TinoPay service ID |
| `pay_codes` | body | array | yes | — |

## Example request

```bash
curl -X PUT "https://api.tino.vn/service/100001/tinopay/pay-codes" \
  -H "Authorization: Bearer $TINO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "pay_codes": [
    {
      "prefix": "DH",
      "suffix_from": 6,
      "suffix_to": 8,
      "character_type": "NumberOnly"
    },
    {
      "prefix": "TNG",
      "suffix_from": 1,
      "suffix_to": 12,
      "character_type": "NumberOnly"
    }
  ]
}'
```

`$TINO_TOKEN` is the TinoPay service owner's sign-in token. Path parameters in the example are sample values.

SDK ([SDK & examples](/en/docs/sdk)): no dedicated function yet, use `client.request("PUT", "/service/@id/tinopay/pay-codes")`.

## Example response

```json
{
 "data": [
  {
   "prefix": "DH",
   "suffix_from": 6,
   "suffix_to": 8,
   "character_type": "NumberOnly"
  },
  {
   "prefix": "TNG",
   "suffix_from": 1,
   "suffix_to": 12,
   "character_type": "NumberOnly"
  }
 ]
}
```

Sample built from the TinoPay API v1 documentation (Tino relays TinoPay data as is); values are examples.
