Actualizar suscripción en Asaas, con una API

Actualiza una suscripción. Los cambios valen para los cobros aún no generados, salvo que updatePendingPayments sea true. status INACTIVE suspende la suscripción y conserva sus cobros, y ACTIVE la reactiva con un nuevo nextDueDate.

Identificador
asaas_update_subscription

La llamada

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

Tu sistema envía el id de la conexión de tu cliente y los argumentos de la tool. Los headers son los mismos de toda la API de Connect: el token de tu producto y el token de tu cliente.

Parámetros

Las descripciones de los parámetros siguen la documentación oficial de la app, en inglés.

ParámetroTipoObligatorioDescripción
idstringSíId of the subscription, starting with sub_, from List subscriptions or Create subscription.
valuenumberNoNew amount of each payment, in reais. A credit card subscription only changes value with card tokenization enabled on the account.
statusstringNoINACTIVE stops generating payments and keeps the existing ones. ACTIVE reactivates the subscription and needs a new nextDueDate.Valores: ACTIVE, INACTIVE
nextDueDatestringNoDue date of the next payment not generated yet, in YYYY-MM-DD. It does not move the payments already generated.
billingTypestringNoHow the customer pays each payment. UNDEFINED lets the payer choose among the methods enabled on the account.Valores: BOLETO, PIX, CREDIT_CARD, UNDEFINED
cyclestringNoHow often a payment is generated. BIWEEKLY is every two weeks and BIMONTHLY every two months.Valores: WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, YEARLY
descriptionstringNoDescription of the subscription, shown to the payer.
endDatestringNoLast due date of the subscription, in YYYY-MM-DD.
updatePendingPaymentsbooleanNotrue also applies the changes to the pending payments already generated.
externalReferencestringNoIdentifier of the subscription in your own system, usable as a filter in List subscriptions.
discountobjectNoDiscount for paying each payment early.
interestobjectNoInterest for paying after the due date. Leave it out to keep the current setting.
fineobjectNoFine for paying after the due date. Leave it out to keep the current setting.

Conexiones posibles

Tu cliente conecta su cuenta de Asaas una sola vez, con uno de los modos de abajo. La misma conexión sirve para todas las tools del toolkit.

Clave de API

Tu cliente pega la clave de la app en una pantalla de Connect, o tu sistema envía la clave con POST /api/customer-toolkits, sin pantalla.

La respuesta

Si la llamada tiene éxito, Connect conserva el status y el cuerpo de la respuesta de la app. Los errores HTTP devueltos por la app usan el objeto {error, api_error}; la autenticación o validación pueden fallar antes de la ejecución. El header X-Toolkit-Execution-Id identifica la ejecución registrada, disponible en GET /api/tools/executions/{uuid}.

Lista para agentes de IA

El input de esta tool es un JSON Schema, disponible en GET /api/tools/asaas_update_subscription. Se convierte en la definición de tool de tu agente sin conversión.

Otras tools de Asaas

Ver las 12 tools

Toolkits de la misma categoría

Ver los 100 toolkits

Mira Connect aplicado a tu producto.

Pruébalo durante 15 días sin tarjeta, o cuéntale tu caso a nuestro equipo.