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

# 快速开始

> 在 5 分钟内用 UQPAY 沙盒受理你的第一笔卡支付。

本指南将带你在沙盒环境中，通过 Direct API 集成方式受理一笔卡支付。

<Info>
  **前置条件**

  * 已启用 Global Acquiring 的 UQPAY 沙盒账户
  * 通过 [Access Token](/zh/account-center/v1.6/api-reference/access-token) 接口获取的 API Token
</Info>

<Steps>
  <Step title="使用卡支付方式创建 Payment Intent">
    向 Create Payment Intent 接口发送请求，并传入一张测试卡号。这样可以在一次调用中完成 payment intent 的创建和支付处理。

    ```bash theme={null}
    curl -X POST https://api-sandbox.uqpaytech.com/api/v2/payment_intents/create \
      -H "Content-Type: application/json" \
      -H "x-auth-token: Bearer {your_access_token}" \
      -H "x-client-id: {your_client_id}" \
      -H "x-idempotency-key: $(uuidgen)" \
      -d '{
        "amount": "8.98",
        "currency": "SGD",
        "payment_method": {
          "type": "card",
          "card": {
            "card_name": "UQPAY",
            "card_number": "5346930100108117",
            "expiry_month": "12",
            "expiry_year": "2026",
            "cvc": "811",
            "network": "mastercard",
            "billing": {
              "first_name": "UQPAY",
              "last_name": "ACQ",
              "email": "acq@uqpay.com",
              "phone_number": "0524-91353515",
              "address": {
                "country_code": "SG",
                "state": "Singapore",
                "city": "Singapore",
                "street": "444 Orchard Rd, Midpoint Orchard, Singapore",
                "postcode": "924011"
              }
            },
            "auto_capture": true,
            "authorization_type": "authorization",
            "three_ds_action": "skip_3ds"
          }
        },
        "merchant_order_id": "my-first-order-001",
        "description": "Quickstart test payment",
        "metadata": {},
        "return_url": "https://example.com/callback"
      }'
    ```
  </Step>

  <Step title="检查响应">
    支付成功时会立即返回 `intent_status: "SUCCEEDED"`：

    ```json theme={null}
    {
      "amount": 8.98,
      "currency": "SGD",
      "intent_status": "SUCCEEDED",
      "payment_intent_id": "PI1933438751883661312",
      "latest_payment_attempt": {
        "attempt_id": "PA1933438751988518912",
        "attempt_status": "CAPTURE_REQUESTED",
        "amount": 8.98,
        "captured_amount": 8.98,
        "currency": "SGD",
        "complete_time": "2025-06-13T16:18:14+08:00",
        "create_time": "2025-06-13T16:18:14+08:00"
      },
      "merchant_order_id": "my-first-order-001",
      "complete_time": "2025-06-13T16:18:14+08:00",
      "create_time": "2025-06-13T16:18:14+08:00"
    }
    ```

    需要关注的关键字段：

    * `intent_status` —— 本次支付的总体结果。完整状态参考见[核心概念](/zh/global-acquiring/v1.6/guide/core-concepts)。
    * `payment_intent_id` —— 本次支付的唯一标识，以 `PI` 开头
    * `latest_payment_attempt.attempt_id` —— 具体的支付尝试，以 `PA` 开头
  </Step>

  <Step title="通过 Retrieve 接口验证（可选）">
    你可以随时查询支付状态：

    ```bash theme={null}
    curl https://api-sandbox.uqpaytech.com/api/v2/payment_intents/{payment_intent_id} \
      -H "x-auth-token: Bearer {your_access_token}" \
      -H "x-client-id: {your_client_id}"
    ```
  </Step>
</Steps>

<h2 id="what-s-next">下一步</h2>

<CardGroup cols={2}>
  <Card title="核心概念" href="/zh/global-acquiring/v1.6/guide/core-concepts" icon="fa-book">
    了解 Payment Intent 和 Payment Attempt 的生命周期与状态流转。
  </Card>

  <Card title="Direct API 集成" href="/zh/global-acquiring/v1.6/guide/direct-api-integration" icon="fa-code">
    搭建包含支付方式处理和 3DS 身份验证的完整收银台流程。
  </Card>

  <Card title="沙盒测试" href="/zh/global-acquiring/v1.6/guide/testing-in-sandbox" icon="fa-flask-vial">
    完整的测试卡清单、电子钱包沙盒配置，以及上线前自查清单。
  </Card>

  <Card title="Webhooks" href="/global-acquiring/v1.6/webhooks/paymentintent-result" icon="fa-bell">
    配置 webhook 通知，实时接收支付状态更新。
  </Card>
</CardGroup>
