> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fluz.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Tango Card

本文档提供将 Fluz 礼品卡供应商 API 适配器与 TangoCard 作为供应商一起使用的具体细节。

## 原生 TangoCard API 与 Fluz API 适配器

### 基础 URL

* 原生 TangoCard API: [https://integration-api.tangocard.com/rass](https://integration-api.tangocard.com/rass)
* Fluz API 适配器：
  * Staging: [https://api-adapter.staging.fluzapp.com/tangocard](https://api-adapter.staging.fluzapp.com/tangocard)

## 认证

### 原生 TangoCard

* 使用用户名和密码的 Basic Authentication。

```text theme={null}
Username: QAPlatform2
Password: apYPfT6HNONpDRUj3CLGWYt7gvIHONpDRUYPfT6Hj
```

### Fluz API 适配器

* 使用带有 `Authorization` 标头的 Basic Authentication（与所有供应商集成相同）。

```text theme={null}
Authorization: Basic <FLUZ-API-Key>
```

## API 端点对比

| Operation                  | TangoCard Endpoint                 | Fluz Endpoint                      | Notes               |
| :------------------------- | :--------------------------------- | :--------------------------------- | :------------------ |
| Get Order                  | `GET /v2/orders/:referenceOrderID` | `GET /v2/orders/:referenceOrderID` | 获取特定订单的详情           |
| Get All Orders             | `GET /v2/orders/`                  | `GET /v2/orders`                   | 获取所有订单              |
| Create Order               | `GET /v2/orders/`                  | `POST /v2/orders/`                 | 创建新的礼品卡订单（作为后台操作处理） |
| Get Balance (All Accounts) | `GET /v2/accounts`                 | `GET /v2/accounts`                 | 获取所有账户的余额信息         |
| Get Balance (By Account)   | `GET /v2/accounts/:accountId`      | `GET /v2/accounts/:id`             | 获取特定账户的余额           |

# 请求示例

## 创建订单

### 原生 TangoCard 请求：

```text theme={null}
{
  "sendEmail": false,
  "accountIdentifier": "testing1234account",
  "customerIdentifier": "johnr002",
  "utid": "U561593",
  "amount": 50
}
```

### Fluz API 适配器请求：

```text theme={null}
{
  "sendEmail": false,
  "accountIdentifier": "testing1234account",
  "customerIdentifier": "johnr002",
  "utid": "1800FL-US",
  "amount": 40,
  "externalRefID": "d8e118ab-732b-4884-8e8a-70746b5f359e"
}
```

## TangoCard 订单的后台处理

通过 TangoCard 集成的所有购买操作都会作为后台操作处理。不过，为了与 TangoCard 的 API 行为保持兼容，Fluz API 适配器默认可能会同步返回完整结果。

<Callout icon="📘">
  **注意：** 即使结果看起来是同步的，所有购买仍会在内部作为后台操作进行调度和跟踪，以提高可靠性并更好地处理重试。
</Callout>

## 使用 cURL 的示例

### 示例 1：获取特定订单

```text theme={null}
# Get a specific order with TangoCard via Fluz API Adapter
curl -X GET "https://api-adapter.staging.fluzapp.com/tangocard/v2/orders/72991f5a-b389-404e-98b0-ac5444839ca9" \
  -H "Authorization: Basic <FLUZ-API-Key>"
```

### 示例 2：获取所有订单

```text theme={null}
# Get all orders with TangoCard via Fluz API Adapter
curl -X GET "https://api-adapter.staging.fluzapp.com/tangocard/v2/orders" \
  -H "Authorization: Basic <FLUZ-API-Key>"
```

### 示例 3：获取所有账户的余额

```text theme={null}
# Get Balance for all accounts with TangoCard via Fluz API Adapter
curl -X GET "https://api-adapter.staging.fluzapp.com/tangocard/v2/accounts" \
  -H "Authorization: Basic <FLUZ-API-Key>"
```

### 示例 4：获取特定账户的余额

```text theme={null}
# Get Balance for a specific account with TangoCard via Fluz API Adapter
curl -X GET "https://api-adapter.staging.fluzapp.com/tangocard/v2/accounts/testing1234account" \
  -H "Authorization: Basic <FLUZ-API-Key>"
```

### 示例 5：创建新订单

```text theme={null}
# Create Order with TangoCard via Fluz API Adapter
# Note: This operation runs as a background process but may return complete results
curl -X POST "https://api-adapter.staging.fluzapp.com/tangocard/v2/orders" \
  -H "Authorization: Basic <FLUZ-API-Key>" \
  -H "Content-Type: application/json" \
  -d '{
    "sendEmail": false,
    "accountIdentifier": "testing1234account",
    "customerIdentifier": "johnr002",
    "utid": "1800FL-US",
    "amount": 40,
    "externalRefID": "d8e118ab-732b-4884-8e8a-70746b5f359e"
  }'
```
