POST /v1/conversations/{id}/charges
const url = 'https://seu-endereco-da-api/v1/conversations/example/charges';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"templateId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","variables":["example"],"provider":"asaas","valueCents":1,"dueDate":"example","description":"example","document":"example","expireAfterDays":1,"dealId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","methods":["pix"],"manual":{"pixCode":"example","boletoLine":"example","paymentUrl":"example"},"order":{"items":[{"retailerId":"example","name":"example","amountCents":1,"quantity":1}],"taxCents":1,"shippingCents":1,"discountCents":1},"idempotencyKey":"example","confirmDuplicate":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://seu-endereco-da-api/v1/conversations/example/charges \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "templateId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "variables": [ "example" ], "provider": "asaas", "valueCents": 1, "dueDate": "example", "description": "example", "document": "example", "expireAfterDays": 1, "dealId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "methods": [ "pix" ], "manual": { "pixCode": "example", "boletoLine": "example", "paymentUrl": "example" }, "order": { "items": [ { "retailerId": "example", "name": "example", "amountCents": 1, "quantity": 1 } ], "taxCents": 1, "shippingCents": 1, "discountCents": 1 }, "idempotencyKey": "example", "confirmDuplicate": true }'Permissão que a Chave de acesso precisa: Enviar mensagem e atender (conversations:write) e Emitir e cancelar cobranças pelo Asaas (charges:manage).
Authorizations
Seção intitulada “Authorizations”Parameters
Seção intitulada “Parameters”Path Parameters
Seção intitulada “Path Parameters”Request Bodyrequired
Seção intitulada “Request Bodyrequired”object
object
object
object
Responses
Seção intitulada “Responses”object
object
Null for a manual charge
Methods the charge offers, in the order they are sent
Payment link: the Asaas invoice page, or the link typed for a manual charge
Pix copy and paste code
Boleto digitable line
Order items, only for a charge sent as order details
object
object
Asaas page with the proof of payment, known once the payment is confirmed
When the charge stops accepting payment
When the money became available in the Asaas account
How many times the payment message was sent again to the customer
Example
{ "charge": { "provider": "asaas", "status": "creating", "environment": "sandbox", "methods": [ "pix" ] }}Not an approved payment template, wrong variables, invalid code or link, or order total that does not match
Conversation, template, deal or Asaas connection not found
The channel is not WhatsApp Business, an open charge exists without confirmDuplicate, or the charge is still being created
A method has no code or link, the Pix receiver is missing, the payer CPF/CNPJ is missing, or Asaas refused
Asaas did not answer