Pular para o conteúdo

POST /v1/charges/{id}/messages

POST
/v1/charges/{id}/messages
curl --request POST \
--url https://seu-endereco-da-api/v1/charges/example/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "conversationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "templateId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "variables": [ "example" ], "idempotencyKey": "example" }'

Permissão que a Chave de acesso precisa: Enviar mensagem e atender (conversations:write) e Emitir e cancelar cobranças pelo Asaas (charges:manage).

id
required
string
Media typeapplication/json
object
conversationId
required
string format: uuid
templateId
required
string format: uuid
variables
required
Array<string>
idempotencyKey
required
string
>= 8 characters <= 64 characters

Example generated

{
"conversationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"templateId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"variables": [
"example"
],
"idempotencyKey": "example"
}
Media typeapplication/json
object
charge
required
object
id
required
string
provider
required
string
Allowed values: asaas manual
contactId
required
string
dealId
required
string
nullable
status
required
string
Allowed values: creating pending overdue paid refunded chargeback canceled expired failed
environment
required

Null for a manual charge

string
nullable
Allowed values: sandbox production
valueCents
required
number
description
required
string
dueDate
required
string format: date
methods
required

Methods the charge offers, in the order they are sent

Array<string>
Allowed values: pix boleto payment_link
invoiceUrl
required

Payment link: the Asaas invoice page, or the link typed for a manual charge

string
nullable
pixCode
required

Pix copy and paste code

string
nullable
boletoLine
required

Boleto digitable line

string
nullable
order
required

Order items, only for a charge sent as order details

object
items
required
Array<object>
object
retailerId
required
string
name
required
string
amountCents
required
number
quantity
required
number
taxCents
required
number
shippingCents
required
number
discountCents
required
number
receiptUrl
required

Asaas page with the proof of payment, known once the payment is confirmed

string
nullable
failureReason
required
string
nullable
expiresAt
required

When the charge stops accepting payment

string format: date-time
nullable
paidAt
required
string format: date-time
nullable
availableAt
required

When the money became available in the Asaas account

string format: date-time
nullable
refundedAt
required
string format: date-time
nullable
canceledAt
required
string format: date-time
nullable
expiredAt
required
string format: date-time
nullable
createdAt
required
string format: date-time
updatedAt
required
string format: date-time
createdByName
required
string
nullable
markedPaidByName
required
string
nullable
lastResentAt
required
string format: date-time
nullable
lastResentByName
required
string
nullable
resendCount
required

How many times the payment message was sent again to the customer

number
messageId
required
string

Example

{
"charge": {
"provider": "asaas",
"status": "creating",
"environment": "sandbox",
"methods": [
"pix"
]
}
}

Not an approved payment template of the conversation’s account, or wrong variable count

Charge, conversation or template not found

The charge is not open, lacks a method of the template, belongs to another contact, or the channel is not WhatsApp Business

The Pix receiver is missing for an order by Pix