Payment Methods

Asociar Payment Method a Subscription

Changed on

Asocia una Subscription a un Payment Method para que sus cobros puedan realizarse con ese medio de pago. Quedar asociada no garantiza que se cobre con él: si la Subscription tiene más de un Payment Method asociado, el cobro se hace con el que esté activo.

La Subscription y el Payment Method deben pertenecer al mismo Customer de la organización autenticada. Responde 400 cuando la Subscription no existe o cuando no comparte el Customer con el Payment Method, y 404 cuando el Payment Method no existe.

post/subscriptions/associate/payment-method

Request

  • Base URL
    https://api.trytoku.com
  • URL
    https://api.trytoku.com/subscriptions/associate/payment-method
  • Auth
    API key in header x-api-key

Headers

x-account-keystring

Llave de API de una Account, para operar sobre esa Account en lugar de la principal.

Request body

clabestring

CLABE de la cuenta a asociar, como alternativa a id_payment_method.

exclude_from_recurringboolean
id_orchestrationstring

Identificador de la orquestación en la que se enmarca esta asociación, cuando la llamada forma parte de un proceso asíncrono mayor.

id_payment_methodstring

Payment Method con el que se cobrará la Subscription.

id_subscriptionstring required

Subscription que se quiere cobrar con el Payment Method.

payment_scope'SUBSCRIPTION' | 'CUSTOMER'

Qué deudas puede pagar un medio de pago.

SUBSCRIPTION lo ata a las Subscriptions con las que se inscribió y solo paga deudas de esas Subscriptions. CUSTOMER lo ata al Customer y paga cualquier deuda suya, venga de la Subscription que venga.

tokenstring

Token del medio de pago a asociar, como alternativa a id_payment_method.

Example request

{
  "id_payment_method": "pm_pBf2NL0d0gvBM7Ei_1E3HIWnTN4W93_O",
  "id_subscription": "sub_Yx4Qb1oT8kFhLmN2_9AwZrJvE6Ss0uKd"
}

Response

Successful Response

id_payment_methodstring required

Payment Method del par.

id_subscriptionstring required

Subscription del par.

messagestring required

Mensaje del resultado. Cuando la asociación falló, describe el motivo del rechazo.

successboolean

Es true cuando el par quedó asociado.

Example response

{
  "id_payment_method": "pm_pBf2NL0d0gvBM7Ei_1E3HIWnTN4W93_O",
  "id_subscription": "sub_Yx4Qb1oT8kFhLmN2_9AwZrJvE6Ss0uKd"
}

Changes

    • breaking

      request body became required

    • info

      api operation id attach-a-payment-method-to-subscription removed and replaced with associate_subscription

    • info

      api tag Payment Methods added

    • info

      added the new optional header request parameter x-account-key

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      added the required property to the response with the status