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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 理解流程

> 通过图表和步骤序列了解支付、注册、存储令牌和 Headless SDK 流程

> [!NOTE]
>
> **This page documents a legacy SDK.** Starting a new integration? Use the [Yuno SDK](https://docs.y.uno/docs/yuno-sdk/get-started.md). Already on a legacy SDK? Follow the [migration guide](https://docs.y.uno/docs/yuno-sdk/migration/overview.md).
>
> The new **Yuno SDK** (Web v2.x, iOS v3.x, Android v3.x, React Native v2.x) replaces the Full, Lite, Seamless, Render, Headless, and Secure Fields SDKs with one API across every platform. Legacy SDKs remain supported side by side during the transition and are scheduled for deprecation in **2027**. Contact your Account Manager for migration planning.

在 Yuno SDK 中，**支付流程**和**注册流程**是分开的。支付是完成交易的过程。注册是将支付方式（例如卡片）保存到客户账户以供将来使用的过程。本页面通过图表和步骤序列从宏观层面解释这两种流程。有关实现细节，请参阅[快速入门指南](https://docs.y.uno/zh-hans/docs/sdks/overview/quickstart.md)和各平台流程页面（[Web](https://docs.y.uno/docs/sdks/full-checkout/web-payments)、[iOS](https://docs.y.uno/docs/sdks/full-checkout/ios-payments)、[Android](https://docs.y.uno/docs/sdks/full-checkout/android-payments)）。

## 支付流程

SDK 提供统一的支付体验：客户在单一集成中使用多种支付方式完成交易。下图展示了主要的支付工作流程。

[支付流程图](https://yuno-diagrams-public.pages.dev/diagrams/sdks/overview/understanding-flows/full-checkout-flow.html)

请求响应成功

### 支付流程步骤

1. 商户服务器：`Create Customer` → Yuno 服务器：`Creates Customer`
2. 商户客户端：`Initiate Checkout` → 商户服务器：`Create Checkout session`
3. 商户服务器：`Create Checkout session` → Yuno 服务器：`Creates Checkout session`
4. 商户客户端：`Initiate Checkout` → `Initiate SDK` 以继续支付流程
5. 商户客户端：`Initiate SDK` 以继续支付流程 → Yuno SDK：`Receive checkout session`
6. Yuno SDK：`Receive checkout session` → `List payment methods`
7. Yuno SDK：`List payment methods` → 用户选择支付方式
8. Yuno SDK：用户选择支付方式 → 带有 `one-time token` 的 callback
9. Yuno SDK：带有 `one-time token` 的 callback → 商户客户端：接收 `one-time token`（一次性使用）
10. 商户客户端：接收 `one-time token`（一次性使用）→ `Initiate payment`
11. 商户客户端：`Initiate payment` → `Initiate SDK` 以继续支付流程
12. 商户客户端：`Initiate SDK` 以继续支付流程 → Yuno SDK：`Continue with the payment flow`
13. Yuno SDK：`Continue with the payment flow` → 显示供用户完成支付的界面
14. Yuno SDK：显示供用户完成支付的界面 → 显示 `payment result`（可选）
15. 商户客户端：`Initiate payment` → 商户服务器：`Create payment`
16. 商户服务器：`Create payment` → Yuno 服务器：在支付服务提供商处 `Creates payment`

### 使用存储令牌的支付流程

如果客户拥有已注册的支付方式，就可以使用**存储令牌**进行支付，而无需再次输入支付详细信息。

[使用存储令牌的支付流程图](https://yuno-diagrams-public.pages.dev/diagrams/sdks/overview/understanding-flows/payment-flow-using-vaulted-token.html)

请求响应成功

#### 存储令牌流程步骤

1. 商户客户端：`Initiate checkout` → 商户服务器：`Create Customer`
2. 商户服务器：`Create Customer` → Yuno 服务器：`Create Customer`
3. 商户客户端：使用 `checkout session` 执行 `Initiate SDK` → Yuno SDK：`Receive checkout session`
4. Yuno SDK：`Receive checkout session` → `List payment methods`
5. Yuno SDK：`List payment methods` → 用户选择支付方式
6. Yuno SDK：用户选择支付方式 → 带有 `one-time token` 的 callback
7. Yuno SDK：带有 `one-time token` 的 callback → 商户客户端：`Initiate payment`
8. 商户客户端：`Initiate payment` → 商户服务器：`Create payment`
9. 商户服务器：`Create payment` → Yuno 服务器：在支付服务提供商处 `Creates payment`
10. 商户客户端：显示 `payment result` → 商户服务器：`Receive payment result`
11. 商户服务器：`Receive payment result` → Yuno 服务器：提供 `payment result`

## 注册流程

**注册**是将支付方式（例如卡片）保存到客户账户以便日后使用（例如通过存储令牌）的过程。full-checkout 支持注册；下图描述了注册工作流程。

[注册流程图](https://yuno-diagrams-public.pages.dev/diagrams/sdks/overview/understanding-flows/payment-method-enrollment-flow.html)

请求响应成功

### 注册流程步骤

1. 商户服务器：`Create Customer` → Yuno 服务器：`Creates Customer`
2. 商户客户端：`Add payment method` → 商户服务器：`Create customer session`
3. 商户服务器：`Create customer session` → Yuno 服务器：`Creates customer session`
4. 商户客户端：`Display payment methods to enroll` → 商户服务器：`Request available payment methods to enroll`
5. 商户服务器：`Request available payment methods to enroll` → Yuno 服务器：`Returns available payment method`
6. 商户客户端：`Display payment methods to enroll` → 商户客户端：用户选择要注册的支付方式
7. 商户客户端：用户选择要注册的支付方式 → 商户客户端：`Initiate enrollment`
8. 商户客户端：`Initiate enrollment` → 商户客户端：`Initiate SDK` 以继续注册
9. 商户客户端：`Initiate SDK` 以继续注册 → Yuno SDK：`Continue enrollment flow`
10. Yuno SDK：`Continue enrollment flow` → Yuno SDK：显示供用户完成注册的界面
11. 商户服务器：通过 webhook 接收 `enrollment result` → Yuno 服务器：从支付服务提供商处接收 `enrollment results`
12. Yuno 服务器：从支付服务提供商处接收 `enrollment results` → Yuno SDK：显示 `enrollment result`（可选）

## Headless SDK 流程

**Headless SDK** 允许您管理整个用户界面，同时由 Yuno 处理复杂的支付逻辑和安全性（如 3DS），从而提供最大的灵活性。

[Headless SDK 流程图](https://yuno-diagrams-public.pages.dev/diagrams/sdks/overview/understanding-flows/headless-sdk-flow.html)

请求响应成功

### Headless 流程步骤

1. 商户服务器：`Create Customer` → Yuno 服务器：`Creates Customer`
2. 商户客户端：`Initiate Checkout` → 商户服务器：`Create Checkout session`
3. 商户客户端：`Collect Information` → 用户在您的自定义 UI 中输入卡片/支付详细信息。
4. 商户客户端：`Generate Token` → Yuno SDK：调用 `generateToken(details)` 以接收 `one-time token`。
5. 商户客户端：`Process Payment` → 商户服务器：将 `one-time token` 发送到您的 backend。
6. 商户服务器：`Create Payment` → Yuno 服务器：调用[创建支付](https://docs.y.uno/zh-hans/reference/payments/create-payment.md) API。
7. 商户客户端：`Handle Actions` → 如果 API 响应返回 `sdk_action_required: true`，请使用 SDK 处理 3DS 或其他[支付操作](https://docs.y.uno/zh-hans/docs/sdks/headless-web/payment.md#step-7-get-payment-actions)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.