> ## 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.

# Fast Checkout 配送

> 让客户在钱包组件中选择已保存的配送地址和配送方式，并在支付中接收所选内容

Fast Checkout 让客户能够 **在钱包组件内** 选择已保存的配送地址和配送方式，首先支持 Revolut Pay。由于支付在客户做出选择之前就已创建，所选内容会以异步方式到达 Yuno，并在之后附加到支付上：您会在 `GET /payments/{id}` 和支付 webhooks 中以顶层 `shipping` 节点的形式收到它。

## 工作原理

1. 您使用所提供的配送选项（`shipping_methods`）创建结账会话。
2. 创建支付时，Yuno 会将这些选项转发给钱包，并由组件进行渲染。
3. 客户在组件内选择已保存的地址和配送方式。
4. 钱包通知 Yuno，Yuno 会将所选内容附加到支付上，并在付款方没有配送地址时填充 `customer_payer.shipping_address`。
5. 您会在支付 webhook 和 `GET /payments/{id}` 中收到所选内容。

> [!NOTE]
>
> 配送费是一个固定价格，**已包含在支付金额中**：`payment.amount` 永远不会因所选内容而改变。

## 在会话中提供配送选项

在创建 [结账会话](https://docs.y.uno/zh-hans/reference/checkout-sessions/create-checkout-session.md) 时发送 `shipping_methods`。第一个配送方式会在组件中被预先选中，并且每个配送方式都需要其 `summary_items` 明细（钱包显示的价格摘要由它决定）。如果您不提供配送方式，但希望显示逐项明细或自定义钱包页面的总计，请改为在会话根级别发送独立的 `summary_items` 数组。请参阅 [Apple Pay](https://docs.y.uno/zh-hans/docs/wallets/apple-pay/sdk-integration/express-checkout.md) 和 [Google Pay](https://docs.y.uno/zh-hans/docs/wallets/google-pay/sdk-integration/express-checkout.md) 的快速结账。

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "amount": { "currency": "GBP", "value": 105.00 },
  "shipping_methods": [
    {
      "id": "express",
      "label": "Express shipping",
      "detail": "Arrives in 1-2 business days",
      "amount": { "currency": "GBP", "value": 5.00 },
      "summary_items": [
        { "id": "order", "label": "Order", "amount": { "currency": "GBP", "value": 100.00 } },
        { "id": "shipping", "label": "Express shipping", "amount": { "currency": "GBP", "value": 5.00 } }
      ]
    }
  ]
}
```

* `shipping_methods[].id` 由商户定义；返回的所选内容会引用它。
* 所有金额均使用会话币种，以主货币单位表示。

## 在支付中接收所选内容

客户确认后，支付会携带所选内容。`GET /payments/{id}` 和支付 webhooks（V1 和 V2 payload）中会返回相同的 `shipping` 节点；字段参考请参阅 [支付对象](https://docs.y.uno/reference/payments/the-payment-object.md)，另请参阅 [webhook 示例](https://docs.y.uno/zh-hans/docs/webhooks/object-and-examples.md)。

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "id": "3455abae-3f3b-4e30-a6d5-8f28b1e176a3",
  "status": "SUCCEEDED",
  "amount": { "currency": "GBP", "value": 105.00 },
  "customer_payer": {
    "shipping_address": {
      "address_line_1": "221B Baker Street",
      "address_line_2": "Flat 2",
      "city": "London",
      "state": "England",
      "zip_code": "NW1 6XE",
      "country": "GB"
    }
  },
  "shipping": {
    "method": {
      "id": "express",
      "label": "Express shipping",
      "amount": { "currency": "GBP", "value": 5.00 }
    },
    "address": {
      "address_line_1": "221B Baker Street",
      "address_line_2": "Flat 2",
      "city": "London",
      "state": "England",
      "zip_code": "NW1 6XE",
      "country": "GB"
    }
  }
}
```

## 行为详情

* 当支付没有配送选择时，`shipping` 键会被 **省略**；未使用 Fast Checkout 的支付不受影响。
* `shipping.method.id` 始终与您在会话中发送的某个 `shipping_methods[].id` 匹配；不匹配的所选内容会被丢弃，但支付状态仍会更新。
* 仅当付款方尚无配送地址时，才会使用 `shipping.address` 填充 `customer_payer.shipping_address`；您在支付请求中发送的地址永远不会被覆盖。
* 所选内容具有幂等性：包含相同配送信息的重复通知不会改变支付。

## 可用性

Fast Checkout 配送适用于启用了 `requestShipping` 的 Web SDK 集成中的 **Revolut Pay**。请联系您的 Yuno 代表为您的账户启用此功能。

对于在客户仍在选择时更新支付页面的钱包，请参阅 [iOS 上的 Apple Pay 快速结账](https://docs.y.uno/zh-hans/docs/wallets/apple-pay/sdk-integration/express-checkout.md) 和 [Android 上的 Google Pay 快速结账](https://docs.y.uno/zh-hans/docs/wallets/google-pay/sdk-integration/express-checkout.md)。


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