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

# 制定分期付款计划

此接口用于为 Payin 交易创建分期付款计划，让您可以为客户提供分期支付购物款项的灵活性。您可以指定分期数、每期金额及其他相关详情。响应将包含分期付款计划的详细信息，例如应付总金额以及每期的到期日。

> **令牌过期**
>
> 响应中提供的令牌自生成之时起 **10 分钟**内有效。超过此期限后，该令牌将过期，无法再用于处理分期付款计划。


## OpenAPI

````yaml openapi/zh/localpayment.json POST /api/payin/installments-plan
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/payin/installments-plan:
    post:
      summary: 制定分期付款计划
      operationId: installments
      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
              properties:
                paymentMethod:
                  type: object
                  properties:
                    code:
                      type: string
                      description: '[支付方式代码](/zh/reference/get-available-payment-methods)。'
                  required:
                    - code
                country:
                  type: string
                  description: '[国家](/zh/reference/country-codes)。ISO 3166-1 alpha-3。'
                currency:
                  type: string
                  description: '[货币代码](/zh/reference/currency-codes)。'
                amount:
                  type: number
                  description: 总金额。
                accountNumber:
                  type: string
                  description: Localpayment账号。
              required:
                - paymentMethod
                - country
                - currency
                - amount
                - accountNumber
              x-examples:
                Example 1:
                  paymentMethod:
                    code: '1000'
                  country: ARG
                  currency: ARS
                  amount: 2000
                  accountNumber: '{{accountNumber}}'
            examples:
              200 - Installment Plan:
                value:
                  paymentMethod:
                    code: '1000'
                  country: ARG
                  currency: ARS
                  amount: 1000
                  accountNumber: '{{accountNumber}}'
      responses:
        '201':
          description: 创建
          content:
            application/json:
              schema:
                type: object
                properties:
                  installmentsToken:
                    type: string
                    description: 分期付款计划的唯一标识符。此令牌用于引用为交易生成的特定分期付款选项。
                  creationDate:
                    type: string
                    description: 分期付款计划的创建日期和时间。时间戳采用 ISO 8601 格式。
                  expirationDate:
                    type: string
                    description: 分期付款计划到期的日期和时间。到期后，该计划将无法继续使用。时间戳采用 ISO 8601 格式。
                  currency:
                    type: string
                    description: '[货币代码](/zh/reference/currency-codes)。'
                  amount:
                    type: number
                    description: 生成分期付款计划所对应的交易总金额。
                  installments:
                    type: array
                    description: 表示该交易可用的不同分期选项的对象数组。
                    items:
                      type: object
                      properties:
                        installments:
                          type: integer
                          description: 此选项可用的分期期数。
                        installmentAmount:
                          type: number
                          description: 每期应付金额。
                        totalPaymentAmount:
                          type: number
                          description: 所有分期付款需支付的总金额，包括任何融资费用。
                        amountWithInternalFee:
                          type: number
                          description: 总金额，含内部手续费（如适用）。
                        financingFee:
                          type: number
                          description: 为在所选分期期数内为交易提供融资而收取的额外费用。
                x-examples:
                  Example 1:
                    installmentsToken: b71a6973-ffdc-427b-b014-e03eb4462e82
                    creationDate: '2022-03-29T23:53:52.7150456+00:00'
                    expirationDate: '2022-03-30T00:03:52.71509+00:00'
                    currency: ARS
                    amount: 2000
                    installments:
                      - installments: 2
                        installmentAmount: 1100
                        totalPaymentAmount: 2200
                        amountWithInternalFee: 2200
                        financingFee: 200
                      - installments: 3
                        installmentAmount: 941.7187
                        totalPaymentAmount: 2825.156
                        amountWithInternalFee: 2360
                        financingFee: 825.156
                      - installments: 6
                        installmentAmount: 633.17334
                        totalPaymentAmount: 3799.04
                        amountWithInternalFee: 2800
                        financingFee: 1799.04
              examples:
                200 - Installments.:
                  value:
                    installmentsToken: b71a1973-cfdc-4a7b-b014-e03eb4462e82
                    creationDate: '2025-01-01T23:53:52.7150456+00:00'
                    expirationDate: '2025-01-30T00:03:52.71509+00:00'
                    currency: ARS
                    amount: 2000
                    installments:
                      - installments: 2
                        installmentAmount: 1100
                        totalPaymentAmount: 2200
                        amountWithInternalFee: 2200
                        financingFee: 200
                      - installments: 3
                        installmentAmount: 941.7187
                        totalPaymentAmount: 2825.156
                        amountWithInternalFee: 2360
                        financingFee: 825.156
                      - installments: 6
                        installmentAmount: 633.17334
                        totalPaymentAmount: 3799.04
                        amountWithInternalFee: 2800
                        financingFee: 1799.04
        '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:
                401 - Token is invalid or expired:
                  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: 未找到
      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.