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

# 授权付款

授权付款，通过将其状态更新为 `Received` 向您的收款人释放资金。此 endpoint 用于批准处于 `pending` 或 `on-hold` 状态的付款。

您可以使用以下方式之一来确定要授权的付款：

* **按 `internalId`：** Localpayment 的唯一交易标识符。

* **按 `externalId`：** 您自己的交易唯一参考编号。

* **按日期范围：** 授权指定时间段内所有符合条件的付款。

成功的请求会将付款状态更新为 `Received` 并发起资金转账。响应将确认授权状态或提供相关错误详情。


## OpenAPI

````yaml openapi/zh/localpayment.json POST /api/payout/authorize
openapi: 3.1.0
info:
  version: '1.0'
  title: Localpayment
  contact:
    name: Support
    url: mailto:support@localpayment.com
servers:
  - url: https://api.stage.localpayment.com
    description: Stage
security:
  - token: []
paths:
  /api/payout/authorize:
    post:
      summary: 授权付款
      operationId: authorize-payout
      parameters:
        - name: Authorization
          in: header
          description: >-
            用于身份验证的 Bearer
            访问令牌。该令牌可从[获取访问令牌](/zh/reference/get-token)或[刷新访问令牌](/zh/reference/refresh-token)endpoint
            获取。
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              anyOf:
                - type: object
                  properties:
                    dateFrom:
                      type: string
                      description: 开始日期，格式为 `yyyy-mm-dd`。
                    dateTo:
                      type: string
                      description: 最后一天，格式为 `yyyy-mm-dd`。
                  required:
                    - dateFrom
                    - dateTo
                - type: object
                  properties:
                    externalId:
                      type: string
                      description: 系统生成的唯一标识符，用于跟踪交易（包含字母、数字和连字符）。我们建议使用 UUID4 以确保唯一性。
                  required:
                    - externalId
                - type: object
                  properties:
                    internalId:
                      type: string
                      description: Localpayment交易标识符。
                  required:
                    - internalId
              x-examples:
                Example 1:
                  dateFrom: '2025-01-09'
                  dateTo: '2025-01-09'
            examples:
              Date:
                value:
                  dateFrom: '2025-01-09'
                  dateTo: '2025-01-09'
              externalID:
                description: Localpayment transaction identifier.
                value:
                  externalId: 1939b376-2aed-4c7a-bc2b-1157702f00b0
              internalId:
                description: >-
                  A unique identifier generated by your system to track the
                  transaction (alphanumeric and hyphens). We recommend using
                  UUID4 to ensure uniqueness.
                value:
                  internalID: 7d7f7fca-e411-4ba6-b46f-b9fed4d5f3d0
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: 状态码。
                  message:
                    type: string
                    description: 包含补充信息的消息。
                required:
                  - status
                  - message
                x-examples:
                  Example 1:
                    status: 200
                    message: The request will be processed.
              examples:
                The request will be processed:
                  value:
                    status: 200
                    message: The request will be processed.
        '401':
          description: 未经授权。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 回复的补充信息。
                  code:
                    type: string
                    description: 状态码。
                  messages:
                    type: array
                    description: 消息列表。
                    items:
                      type: object
                      properties:
                        token_class:
                          type: string
                          description: Token 类。
                        token_type:
                          type: string
                          description: 令牌类型。
                        message:
                          type: string
                          description: 包含补充信息的消息。
                x-examples:
                  Example 1:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
              examples:
                Example 1:
                  value:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
        '404':
          description: 未找到
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      errors:
                        type: object
                        description: 错误信息。
                        properties:
                          payOutBy:
                            type: array
                            items:
                              type: string
                          '[0].internalId':
                            type: array
                            items:
                              type: string
                      type:
                        type: string
                      title:
                        type: string
                        description: "回复的补充信息。\r\n\r\n"
                      status:
                        type: integer
                        description: 状态码。
                      traceId:
                        type: string
                        description: 错误跟踪标识符。
                    required:
                      - errors
                      - type
                      - title
                      - status
                      - traceId
                  - type: object
                    properties:
                      Status:
                        type: integer
                        description: 状态码。
                      Message:
                        type: string
                        description: 包含补充信息的消息。
                      TraceId:
                        type: string
                        description: 跟踪标识符。
                    required:
                      - Status
                      - Message
                      - TraceId
                    x-examples:
                      Example 1:
                        Status: 404
                        Message: This transacion does not exists.
                        TraceId: d11cea70-7f14-4f11-b66e-13f5f56c2e56
                x-examples:
                  Example 1:
                    errors:
                      payOutBy:
                        - The payOutBy field is required.
                      '[0].internalId':
                        - >-
                          Error converting value
                          "7d7f7fca-e411-4ba6-b4f-b9fed4d5f3d2" to type
                          'System.Guid'. Path '[0].internalId', line 1, position
                          53.
                    type: https://tools.ietf.org/html/rfc7231#section-6.5.1
                    title: One or more validation errors occurred.
                    status: 400
                    traceId: 00-6af59d173e66ad4eb215987cd15d57af-bea3981476c0f347-00
              examples:
                The payOutBy field is required:
                  value:
                    errors:
                      payOutBy:
                        - The payOutBy field is required.
                      '[0].internalId':
                        - >-
                          Error converting value
                          "7d7f7fca-e411-4ba6-b4f-b9fed4d5f3d2" to type
                          'System.Guid'. Path '[0].internalId', line 1, position
                          53.
                    type: https://tools.ietf.org/html/rfc7231#section-6.5.1
                    title: One or more validation errors occurred.
                    status: 400
                    traceId: 00-6af59d173e66ad4eb215987cd15d57af-bea3981476c0f347-00
      security:
        - token: []
      servers:
        - url: https://api.stage.localpayment.com
          description: Stage
components:
  securitySchemes:
    token:
      type: http
      scheme: bearer

````

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