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

# 更新订阅

此服务允许您更新订阅详情，确保您的定期付款不间断。


## OpenAPI

````yaml openapi/zh/localpayment.json POST /api/payin/subscriptions/{externalId}
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/subscriptions/{externalId}:
    post:
      summary: 更新订阅
      operationId: update-subscription
      parameters:
        - name: Authorization
          in: header
          description: >-
            用于身份验证的 Bearer
            访问令牌。该令牌可从[获取访问令牌](/zh/reference/get-token)或[刷新访问令牌](/zh/reference/refresh-token)endpoint
            获取。
          required: true
          schema:
            type: string
        - name: externalId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: number
                  description: 交易金额。
                card:
                  type: object
                  description: 付款卡数据。
                  properties:
                    name:
                      type: string
                      description: ' 持卡人姓名，与借记卡正面印刷的内容一致。'
                    number:
                      type: string
                      description: 卡号（PAN）。
                    cvv:
                      type: string
                      description: 卡片验证值
                    expirationMonth:
                      type: string
                      description: 卡片到期月份。格式为 `MM`。
                      examples:
                        - '01'
                    expirationYear:
                      type: string
                      description: 卡片到期年份。格式为 `YYYY`。
                      examples:
                        - '2025'
                    token:
                      type: string
                      description: 通过发送令牌来使用之前已令牌化的卡。
                  required:
                    - name
                    - number
                    - cvv
                    - expirationMonth
                    - expirationYear
                autoRecurring:
                  type: object
                  description: 订阅属性
                  properties:
                    repetitions:
                      type: integer
                      description: 此付款将被收取的次数。按需重复收款时，请将该参数设为 `value=0`。
                    type:
                      type: string
                      enum:
                        - day
                        - month
                        - custom
                      description: 定义周期性间隔单位。如需按需重复，请将该参数设置为 `value=custom`。
                    trialDays:
                      type: number
                      description: 订阅的试用天数。
                  required:
                    - repetitions
                    - type
                retry:
                  type: object
                  description: 支付重试选项。
                  properties:
                    repetitions:
                      type: number
                      description: 重试收款的次数。
                    intervalUnit:
                      type: string
                      enum:
                        - day
                        - hour
                      description: 执行重试所采用的时间单位。允许的值：`day` 和 `hour`。
                    intervalValue:
                      type: string
                      description: 重试的时间间隔。定义两次重试之间相隔的时间单位数。
                discount:
                  type: object
                  description: 折扣选项。
                  properties:
                    amount:
                      type: string
                      description: 向您的最终用户收取的金额。
                    period:
                      type: number
                      description: 折扣期限。
                  required:
                    - amount
                    - period
                dateToUpdate:
                  type: string
                  description: 仅当请求的更新需要应用于未来日期时适用。格式：`YYYY-MM-DD`。
              required:
                - amount
                - card
                - autoRecurring
              x-examples:
                Example 1:
                  paymentMethod:
                    type: CreditCard
                    code: '1000'
                    flow: DIRECT
                  externalId: '1662647310'
                  country: ARG
                  amount: 100
                  currency: ARS
                  accountNumber: '{{accountNumber}}'
                  conceptCode: '0001'
                  comment: subs test 1 del 7/9 xdia
                  merchant:
                    type: INDIVIDUAL
                    name: Obi Wan
                    lastname: Kenobi
                    document:
                      type: DNI
                      id: '12345678'
                    userReference: abc123
                    email: obiwankenobi@starwars.com
                    phone:
                      countryCode: '54'
                      areaCode: '11'
                      number: '98789632'
                    birthdate: '2000-01-01'
                    nationality: Argentinian
                    address:
                      street: Charruas
                      number: '938'
                      city: Hurlingham
                      state: state
                      country: ARG
                      zipCode: '1688'
                      comment: portero 801
                  payer:
                    type: INDIVIDUAL
                    name: Luke
                    lastname: Skywalker
                    document:
                      id: '37993830'
                      type: DNI
                    email: jane.doe@example.com
                    phone:
                      countryCode: '1'
                      areaCode: '11'
                      number: '98789632'
                    birthdate: 01/01/1990
                    nationality: American
                    address:
                      street: Siempre viva
                      number: '1234'
                      city: Springfield
                      state: Ohio
                      country: USA
                      zipCode: '1686'
                      comment: May the force be with you, always!
                  card:
                    name: APRO
                    number: '4509953566233704'
                    cvv: '123'
                    expirationMonth: '11'
                    expirationYear: '2025'
                    installments: 1
                  type: SOFTWARE
                  autoRecurring:
                    repetitions: 1
                    type: day
            examples:
              200 - Suscription:
                value:
                  dateToUpdate: '2025-01-30'
                  amount: 16000
                  autoRecurring:
                    repetitions: '3'
                    type: month
                    trialDays: '0'
                  retry:
                    repetitions: 2
                    intervalUnit: day
                    intervalValue: 1
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  externalId:
                    type: string
                    description: 系统生成的唯一标识符，用于跟踪交易（包含字母、数字和连字符）。我们建议使用 UUID4 以确保唯一性。
                  internalId:
                    type: string
                    description: Localpayment交易标识符。
                  status:
                    type: object
                    description: 操作状态。
                    properties:
                      code:
                        type: string
                        description: 状态码。
                      description:
                        type: string
                        description: 状态描述。
                      detail:
                        type: string
                        description: 状态详情。
                  errors:
                    type: array
                    description: 交易过程中发生的错误列表。
                    items:
                      type: object
                x-examples:
                  Example 1:
                    externalId: 564b161a-76ba-4a84-b5cf-583f2df8c377
                    internalId: 52425bbd-b68b-4abc-9480-5ae88d53adb3
                    status:
                      code: '107'
                      description: APPROVED
                      detail: Update subscription success
                    errors: []
              examples:
                107 - Update subscription success:
                  value:
                    externalId: 564b161a-76ba-4a84-b5cf-583f2df8c377
                    internalId: 52425bbd-b68b-4abc-9480-5ae88d53adb3
                    status:
                      code: '107'
                      description: APPROVED
                      detail: Update subscription success
                    errors: []
        '400':
          description: 错误的请求
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: object
                    description: 操作状态。
                    properties:
                      code:
                        type: string
                        description: 状态码。
                      description:
                        type: string
                        description: 状态描述。
                      detail:
                        type: string
                        description: 状态详情。
                x-examples:
                  Example 1:
                    status:
                      code: '400'
                      description: ERROR
                      detail: Invalid operation
              examples:
                400 - Invalid operation:
                  value:
                    status:
                      code: '400'
                      description: ERROR
                      detail: Invalid operation
      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.