Mettre à jour un abonnement avec l'API Asaas

Met à jour un abonnement. Les changements s'appliquent aux paiements pas encore générés, sauf si updatePendingPayments vaut true. status INACTIVE suspend l'abonnement et garde ses paiements, et ACTIVE le réactive avec un nouveau nextDueDate.

Identifiant
asaas_update_subscription

L'appel

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>"
  }
}

Votre système envoie l'id de la connexion de votre client et les arguments de la tool. Les headers sont les mêmes que pour toute l'API Connect : le token de votre produit et celui de votre client.

Paramètres

Les descriptions des paramètres suivent la documentation officielle de l'app, en anglais.

ParamètreTypeObligatoireDescription
idstringOuiId of the subscription, starting with sub_, from List subscriptions or Create subscription.
valuenumberNonNew amount of each payment, in reais. A credit card subscription only changes value with card tokenization enabled on the account.
statusstringNonINACTIVE stops generating payments and keeps the existing ones. ACTIVE reactivates the subscription and needs a new nextDueDate.Valeurs : ACTIVE, INACTIVE
nextDueDatestringNonDue date of the next payment not generated yet, in YYYY-MM-DD. It does not move the payments already generated.
billingTypestringNonHow the customer pays each payment. UNDEFINED lets the payer choose among the methods enabled on the account.Valeurs : BOLETO, PIX, CREDIT_CARD, UNDEFINED
cyclestringNonHow often a payment is generated. BIWEEKLY is every two weeks and BIMONTHLY every two months.Valeurs : WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, YEARLY
descriptionstringNonDescription of the subscription, shown to the payer.
endDatestringNonLast due date of the subscription, in YYYY-MM-DD.
updatePendingPaymentsbooleanNontrue also applies the changes to the pending payments already generated.
externalReferencestringNonIdentifier of the subscription in your own system, usable as a filter in List subscriptions.
discountobjectNonDiscount for paying each payment early.
interestobjectNonInterest for paying after the due date. Leave it out to keep the current setting.
fineobjectNonFine for paying after the due date. Leave it out to keep the current setting.

Connexions possibles

Votre client connecte son compte Asaas une seule fois, avec l'un des modes ci-dessous. La même connexion sert à toutes les tools du toolkit.

Clé d'API

Votre client colle la clé de l'app sur un écran de Connect, ou votre système envoie la clé avec POST /api/customer-toolkits, sans écran.

La réponse

En cas de succès, Connect conserve le statut et le corps de la réponse de l'app. Les erreurs HTTP renvoyées par l'app utilisent l'objet {error, api_error} ; l'authentification ou la validation peuvent échouer avant l'exécution. Le header X-Toolkit-Execution-Id identifie l'exécution enregistrée, consultable avec GET /api/tools/executions/{uuid}.

Prête pour les agents IA

L'input de cette tool est un JSON Schema, disponible via GET /api/tools/asaas_update_subscription. Il devient la définition de tool de votre agent sans conversion.

Autres tools Asaas

Voir les 12 tools

Toolkits de la même catégorie

Voir les 100 toolkits

Voyez Connect appliqué à votre produit.

Essayez-le pendant 15 jours sans carte, ou présentez votre cas à notre équipe.