# Create a Sapo integration

`POST /service/@id/tinopay/sapo-integrations` · TinoPay, service owner's sign-in token

The buyer transfers with content holding the order code (prefix + Sapo order number, e.g. `TNG1002` for order #1002): when the amount is enough or more, TinoPay marks the order paid on Sapo. Body: `name` (≤ 100 characters), `store_url` (the store's `.mysapo.net` domain; custom domains are not accepted), `api_key`, `api_secret` (private app on Sapo with read and write access to orders and transactions), `bank_account_id`, `virtual_account` (required for BIDV), `order_prefix` (2–5 letters or digits; when missing from the payment code patterns, TinoPay adds a pattern with a 1–12 digit suffix), `transaction` (`kind`, `source_name`, `status`), `status`. TinoPay tests the Sapo connection before saving; on failure 422 `SAPO_CONNECTION_FAILED` and nothing is created. Paste the returned `snippet` into Sapo Admin → Cấu hình → Trang thanh toán (Settings → Checkout), the additional message field.

## HTTP request

| Item | Value |
| --- | --- |
| URL | `https://api.tino.vn/service/@id/tinopay/sapo-integrations` |
| Method | `POST` |
| 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 |
| `name` | body | string | yes | ≤ 100 |
| `store_url` | body | string | yes | <tên-cửa-hàng>.mysapo.net (tên miền riêng không nhận) |
| `api_key` | body | string | yes | — |
| `api_secret` | body | string | yes | — |
| `bank_account_id` | body | string | yes | — |
| `virtual_account` | body | string | — | Bắt buộc với BIDV |
| `order_prefix` | body | string | yes | 2–5 chữ/số |
| `transaction` | body | array | — | — |
| `status` | body | string | — | active \| inactive |

## Example request

```bash
curl -X POST "https://api.tino.vn/service/100001/tinopay/sapo-integrations" \
  -H "Authorization: Bearer $TINO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Website Sapo",
  "store_url": "<tên-cửa-hàng>.mysapo.net",
  "api_key": "<api_key>",
  "api_secret": "<api_secret>",
  "bank_account_id": "9c1e6f2a-5b7d-4e1a-9f3c-2d8b6a4e0c11",
  "virtual_account": "9624QA01",
  "order_prefix": "TNG"
}'
```

`$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("POST", "/service/@id/tinopay/sapo-integrations")`.

## Example response

```json
{
 "data": {
  "id": 4,
  "name": "Website Sapo",
  "store_url": "<tên-cửa-hàng>.mysapo.net",
  "api_key": "<api_key>",
  "has_api_secret": true,
  "bank_account_id": "9c1e6f2a-5b7d-4e1a-9f3c-2d8b6a4e0c11",
  "virtual_account": "9624QA01",
  "order_prefix": "TNG",
  "transaction": {
   "kind": "capture",
   "source_name": null,
   "status": null
  },
  "status": "active",
  "script_url": "<script_url>",
  "snippet": "<snippet>",
  "last_error": null,
  "last_error_at": null,
  "last_paid_at": "2026-10-24T10:00:00+07:00",
  "created_at": "2026-10-24T09:00:00+07:00",
  "updated_at": "2026-10-24T09:00:00+07:00"
 }
}
```

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