Crear cobro en Asaas, con una API

Crea un cobro para un cliente, por boleto, Pix o tarjeta de crédito, en un pago o en cuotas. La respuesta trae invoiceUrl, la página del cobro para enviar al pagador, y Asaas puede notificar al cliente según su configuración de notificación.

Identificador
asaas_create_payment

La llamada

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

{
  "customer_toolkit": "<connection UUID>",
  "arguments": {
    "customer": "<customer>",
    "billingType": "BOLETO",
    "dueDate": "<dueDate>"
  }
}

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
customerstringSíId of the customer who pays, starting with cus_, from List customers or Create customer.
billingTypestringSíHow the customer pays. UNDEFINED lets the payer choose among the methods enabled on the account, on the payment page.Valores: BOLETO, PIX, CREDIT_CARD, UNDEFINED
valuenumberNoAmount in reais, for example 129.9. Required for a one-time payment; for installments, send installmentCount with totalValue or installmentValue instead.
dueDatestringSíDue date, in YYYY-MM-DD. For installments, the due date of the first one.
descriptionstringNoDescription shown to the payer.
externalReferencestringNoIdentifier of the payment in your own system, usable as a filter in List payments.
installmentCountintegerNoNumber of installments, for a payment in installments. Send it with totalValue or with installmentValue, never both.
totalValuenumberNoTotal in reais split into installmentCount installments. Asaas computes each installment and puts any rounding difference in the last one.
installmentValuenumberNoValue in reais of each installment, instead of totalValue.
discountobjectNoDiscount for paying early.
interestobjectNoInterest for paying after the due date. Leave it out to keep the interest set on the account, because sending it overrides that setting for this payment.
fineobjectNoFine for paying after the due date. Leave it out to keep the fine set on the account, because sending it overrides that setting for this payment.

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_create_payment. 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.