Atualize o método de pagamento de uma assinatura
Substitua o cartão de uma assinatura. Mudar o cartão é uma CIT e pode precisar de 3D Secure — registre um cartão cuja CIT você já fez, ou execute uma CIT de valor zero aqui.
POST /subscription/{id}/payment-method substitui o cartão de uma assinatura e o mandato de
credencial armazenada dela, de modo que toda futura renovação (uma Merchant Initiated Transaction, MIT)
cite o networkTransactionId / networkReferenceId correto.
Mudar o cartão de uma assinatura é sempre uma Cardholder Initiated Transaction (CIT),
e uma CIT pode exigir 3D Secure. Há duas formas de fornecer o novo cartão:
Modo record — card.tokenData
/payment/authorization ou /payment/purchase, depois
anexa o token resultante aqui. Nenhuma chamada ao gateway, nenhum 3DS neste endpoint.
Use isto para qualquer cartão que precise de 3D Secure.Modo CIT — card.nonceData / card.cardData
suspended. Essa CIT não pode realizar um desafio de 3D Secure
— um cartão que exige 3DS falhará.subscription.payment_method_updated.
Modo record (recomendado)
Como a própria CIT deste endpoint não pode fazer um desafio de 3DS, a forma confiável de mudar um cartão é executar você mesmo a CIT onde 3DS é suportado, depois registrá-la:Execute uma CIT com capacidade 3DS
/payment/authorization (uma autorização de valor zero ou pequena) ou /payment/purchase com
card.nonceData.tokenize: true (ou card.cardData.tokenize: true) e um shopper.id.
Trate qualquer actionRequired / desafio de 3DS com o SDK JS exatamente como você faria para um
pagamento normal. Em caso de sucesso a resposta devolve um vault token e
card.networkTransactionId / card.networkReferenceId.Anexe o token à assinatura
POST /subscription/{id}/payment-method com card.tokenData.token definido como esse vault
token. O Therius lê o mandato que o token armazenou na CIT dele — você não precisa passar
networkTransactionId você mesmo. (Passe-o explicitamente apenas quando o cartão teve a CIT feita
fora do Therius.)suspended — ele não executa nenhuma cobrança para
confirmar que o novo cartão funciona. Para uma assinatura suspensa, use o modo CIT (abaixo), ou execute uma
cobrança de recuperação você mesmo primeiro.tokenData.token para modo record; nonceData/cardData para modo CIT; networkTransactionId/networkReferenceId opcionais para um cartão cuja CIT foi feita fora do Therius).
Resposta
Devolve200 OK com o objeto de assinatura atualizado.
Eventos de webhook disparados
Erros
Autorizações
Your secret API key: Bearer prv_production_xxx (production) or Bearer prv_sandbox_xxx (sandbox).
Parâmetros de caminho
Corpo
Your merchant account identifier.
Card input for replacing the card on a subscription. Changing the card is always a CIT and a CIT may require 3D Secure — pick the mode that fits:
• Record mode (tokenData): the token is a card that already completed a CIT elsewhere. Run your own 3DS-capable CIT via /payment/authorization or /payment/purchase (with card.<x>.tokenize: true + shopper.id), then attach the resulting vt_... token here. No gateway call, no 3DS. The mandate is read from the token; pass networkTransactionId / networkReferenceId explicitly only for a card CIT'd outside Therius. Cannot reactivate a suspended subscription.
• CIT mode (nonceData / cardData): runs a zero-value CIT here and can reactivate a suspended subscription — but this CIT cannot carry out a 3D Secure challenge, so a card that requires 3DS will fail. Use record mode for those.
Provide exactly ONE of cardData, nonceData, or tokenData.
- Raw card (PCI DSS)
- SDK nonce
- Vault token
Resposta
Payment method updated
A customer enrollment in a plan. plan is embedded on single-subscription responses. Invoice/event history is not included here - use the invoice endpoints.
Subscription UUID.
The merchant account that owns the subscription.
ID of the plan this subscription is enrolled in.
Subscriber email, used for billing and dunning notifications.
Subscriber name as it appears on invoices.
Subscriber national ID / tax document, where a market requires it (e.g. Brazil CPF/CNPJ).
Brand of the card on the mandate, e.g. visa.
pending - awaiting first charge; trialing - in a free trial; active - billing normally; past_due - a renewal failed and dunning is running; suspended - dunning exhausted, needs a new CIT (POST /subscription/{id}/payment-method in CIT mode) to recover; paused - billing stopped on request, resumable; cancelled - terminated; completed - reached maxBillingCycles.
pending, trialing, active, past_due, suspended, paused, cancelled, completed Start of the current billing period.
End of the current billing period.
When the next renewal charge is scheduled.
Trial start, when the plan has a trial.
Trial end - the first real charge date.
Failed-renewal retry attempts made in the current dunning sequence.
When the subscription first became active.
Deferred start, when creation set a future startAt.
Number of billing cycles charged so far.
When the subscription reached maxBillingCycles.
Parent subscription UUID, for add-on hierarchies.
Whether pause/cancel on the parent cascades to this subscription.
Plan the subscription will switch to at the next cycle, set by a next_billing change-plan.
A reusable billing plan. amount is a flat integer in the currency minor units (with separate currency + exponent) - not an Amount object.

