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

# 创建预扣款通知

> 在 UPI Autopay 定期扣款之前，向客户发送 NPCI 要求的预扣款通知。

在每次 UPI Autopay 定期扣款之前，NPCI 要求提前通知客户。此 endpoint 通过支付服务提供商发送该通知，并返回一个您必须在扣款时引用的 `id`。

该流程包含三个步骤：

1. **通知**：使用委托的 `vaulted_token`、即将扣款的 `amount` 和 `billing_date` 调用此 endpoint。服务提供商路由由 `origin_payment_id`（创建委托的支付）或显式的 `provider_data` 决定。
2. **检查状态**：`SENT` 表示服务提供商已送达通知，并在 `provider_data.provider_notification_id` 中返回其参考号。
3. **扣款**：创建定期支付，并将 `payment_method.detail.bank_transfer.pre_debit_notification_id` 设为返回的 `id`。Yuno 会解析服务提供商参考号并自动转发，请参阅[创建支付](https://docs.y.uno/zh-hans/reference/payments/create-payment.md)。

此请求需要 `X-Idempotency-Key`。重复使用 `merchant_reference` 会返回您账户中已有的通知。


## OpenAPI

````yaml openapi/zh-hans/pre-debit-notifications/create-pre-debit-notification.json POST /predebit-notify
openapi: 3.1.0
info:
  title: pre-debit-notifications
  version: 1.0.0
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
paths:
  /predebit-notify:
    post:
      summary: 创建预扣款通知
      description: >-
        在 UPI Autopay 定期扣款之前，向客户发送 NPCI 要求的预扣款通知。提供商负责送达通知并返回一个参考编号：请保留返回的
        id，并在定期扣款时将其作为
        payment_method.detail.bank_transfer.pre_debit_notification_id 发送。
      operationId: create-pre-debit-notification
      parameters:
        - name: X-Idempotency-Key
          in: header
          required: true
          description: 在 HTTP 标头中使用的唯一标识符，用于确保请求只被处理一次，即使因网络问题或超时而重试。
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - account_id
                - merchant_reference
                - amount
                - billing_date
              properties:
                account_id:
                  type: string
                  format: uuid
                  description: 您的 Yuno 账户 ID。
                merchant_reference:
                  type: string
                  description: 您为此通知设置的唯一参考编号。重复使用同一参考编号会返回已有的通知（按账户保证幂等）。
                description:
                  type: string
                  description: 通知中向客户显示的文本（例如订阅名称和续订提示）。
                amount:
                  type: object
                  required:
                    - currency
                    - value
                  properties:
                    currency:
                      type: string
                      description: 即将扣款的 ISO 4217 货币代码（UPI Autopay 为 INR）。
                      example: INR
                    value:
                      type: string
                      description: 即将扣款的金额。
                      example: '499.00'
                billing_date:
                  type: string
                  format: date
                  description: 即将扣款的日期（YYYY-MM-DD）。根据 NPCI 的要求，须在扣款前至少 24 小时通知客户。
                billing_sequence_number:
                  type: string
                  description: 该次扣款在委托协议中的序号（例如，第二次扣款为 2）。
                origin_payment_id:
                  type: string
                  format: uuid
                  description: >-
                    委托协议创建支付的 ID。提供后，Yuno 会根据其成功扣款得出提供商和连接。origin_payment_id 或
                    provider_data 二者必须提供其一。
                customer_payer:
                  type: object
                  properties:
                    id:
                      type: string
                      format: uuid
                      description: Yuno 客户 ID。
                    merchant_customer_id:
                      type: string
                      description: 您的客户标识符。
                payment_method:
                  type: object
                  properties:
                    type:
                      type: string
                      description: 委托协议的支付方式类型。
                      example: UPI_AUTOPAY
                    vaulted_token:
                      type: string
                      format: uuid
                      description: 已注册委托协议的存储令牌。Yuno 据此解析提供商的委托协议凭证。
                provider_data:
                  type: object
                  description: >-
                    显式指定提供商路由。origin_payment_id 或 provider_data（id +
                    connection_id）二者必须提供其一。
                  properties:
                    id:
                      type: string
                      description: 提供商 ID（例如 EBANX）。
                      example: EBANX
                    connection_id:
                      type: string
                      format: uuid
                      description: 用于发送通知的连接。
            examples:
              UPI Autopay:
                value:
                  account_id: 00000000-0000-0000-0000-000000000000
                  merchant_reference: subscription-2026-08-INV-00187
                  description: Your subscription renews soon
                  amount:
                    currency: INR
                    value: '499.00'
                  billing_date: '2026-08-01'
                  billing_sequence_number: '2'
                  customer_payer:
                    id: 9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d
                  payment_method:
                    type: UPI_AUTOPAY
                    vaulted_token: 7c9e6679-7425-40de-944b-e07fc1f90ae7
                  provider_data:
                    id: EBANX
                    connection_id: 6c1f6bfb-736b-439e-b568-32f671f65256
      responses:
        '201':
          description: 通知已创建。请检查 status：SENT 表示提供商已送达。
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: >-
                      预扣款通知的唯一标识符。请在定期扣款时将其作为
                      payment_method.detail.bank_transfer.pre_debit_notification_id
                      引用。
                  account_id:
                    type: string
                    format: uuid
                    description: 您的 Yuno 账户 ID。
                  status:
                    type: string
                    enum:
                      - SENT
                      - REJECTED
                      - ERROR
                    description: SENT：提供商已接受并送达通知。REJECTED：提供商拒绝了通知。ERROR：通知无法转发。
                  merchant_reference:
                    type: string
                    description: 您为此通知设置的唯一参考编号（按账户保证幂等）。
                  description:
                    type: string
                    description: 通知中向客户显示的文本。
                  amount:
                    type: object
                    required:
                      - currency
                      - value
                    properties:
                      currency:
                        type: string
                        description: 即将扣款的 ISO 4217 货币代码（UPI Autopay 为 INR）。
                        example: INR
                      value:
                        type: string
                        description: 即将扣款的金额。
                        example: '499.00'
                  billing_date:
                    type: string
                    format: date
                    description: 即将扣款的日期（YYYY-MM-DD）。
                  origin_payment_id:
                    type: string
                    format: uuid
                    description: 用于得出提供商和连接的委托协议创建支付（若已提供）。
                  provider_data:
                    type: object
                    properties:
                      id:
                        type: string
                        description: 处理该通知的提供商（例如 EBANX）。
                      connection_id:
                        type: string
                        format: uuid
                        description: 用于发送通知的连接。
                      provider_transaction_id:
                        type: string
                        description: 提供商交易参考编号（若可用）。
                      provider_notification_id:
                        type: string
                        description: 已送达通知的提供商参考编号。当定期扣款引用此通知时，Yuno 会自动解析并转发给提供商。
                      raw_request:
                        type: object
                        description: 经过混淆处理的提供商请求。仅对在允许列表中的组织返回。
                      raw_response:
                        type: object
                        description: 经过混淆处理的提供商响应。仅对在允许列表中的组织返回。
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                    format: date-time
        '400':
          description: 参数无效（例如缺少提供商路由，或 billing_date 格式错误）。
        '422':
          description: >-
            vaulted_token
            没有适用于所解析提供商的已存储凭证（STORED_CREDENTIAL_NOT_FOUND），或原始支付没有可用的连接（PROVIDER_CONNECTION_REQUIRED）。
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: public-api-key
      x-default: <Your public-api-key>
    sec1:
      type: apiKey
      in: header
      name: private-secret-key
      x-default: <Your private-secret-key>

````

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