Atualizar assinatura no Asaas, por uma API

Atualiza uma assinatura. As mudanças valem para as cobranças ainda não geradas, a menos que updatePendingPayments seja true. status INACTIVE suspende a assinatura e mantém as cobranças, e ACTIVE a reativa com um novo nextDueDate.

Identificador
asaas_update_subscription

A chamada

POST https://connect.reportei.com/api/tools/asaas_update_subscription/execute
Authorization: Bearer <merchant token>
x-customer-token: <customer token>
Content-Type: application/json
Accept: application/json

{
  "customer_toolkit": "<connection UUID>",
  "arguments": {
    "id": "<id>"
  }
}

Seu sistema envia o id da conexão do cliente e os argumentos da tool. Os headers são os mesmos de toda a API do Connect: o token do seu produto e o token do cliente.

Parâmetros

As descrições dos parâmetros seguem a documentação oficial do app, em inglês.

ParâmetroTipoObrigatórioDescrição
idstringSimId of the subscription, starting with sub_, from List subscriptions or Create subscription.
valuenumberNãoNew amount of each payment, in reais. A credit card subscription only changes value with card tokenization enabled on the account.
statusstringNãoINACTIVE stops generating payments and keeps the existing ones. ACTIVE reactivates the subscription and needs a new nextDueDate.Valores: ACTIVE, INACTIVE
nextDueDatestringNãoDue date of the next payment not generated yet, in YYYY-MM-DD. It does not move the payments already generated.
billingTypestringNãoHow the customer pays each payment. UNDEFINED lets the payer choose among the methods enabled on the account.Valores: BOLETO, PIX, CREDIT_CARD, UNDEFINED
cyclestringNãoHow often a payment is generated. BIWEEKLY is every two weeks and BIMONTHLY every two months.Valores: WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, YEARLY
descriptionstringNãoDescription of the subscription, shown to the payer.
endDatestringNãoLast due date of the subscription, in YYYY-MM-DD.
updatePendingPaymentsbooleanNãotrue also applies the changes to the pending payments already generated.
externalReferencestringNãoIdentifier of the subscription in your own system, usable as a filter in List subscriptions.
discountobjectNãoDiscount for paying each payment early.
interestobjectNãoInterest for paying after the due date. Leave it out to keep the current setting.
fineobjectNãoFine for paying after the due date. Leave it out to keep the current setting.

Conexões possíveis

O seu cliente conecta a conta do Asaas uma vez, por um dos modos abaixo. A mesma conexão serve para todas as tools do toolkit.

Chave de API

O cliente cola a chave do app numa tela do Connect, ou o seu sistema envia a chave por POST /api/customer-toolkits, sem tela.

A resposta

Em caso de sucesso, o Connect preserva o status e o corpo da resposta do app. Erros HTTP retornados pelo app usam o envelope {error, api_error}; falhas de autenticação ou validação podem ocorrer antes da execução. O header X-Toolkit-Execution-Id identifica a execução registrada, consultável em GET /api/tools/executions/{uuid}.

Pronta para agentes de IA

O input desta tool é um JSON Schema, disponível em GET /api/tools/asaas_update_subscription. Ele vira a definição de tool do seu agente sem conversão.

Outras tools do Asaas

Ver as 12 tools

Toolkits da mesma categoria

Ver os 100 toolkits

Veja o Connect aplicado ao seu produto.

Teste por 15 dias sem cartão, ou mostre seu cenário ao nosso time.