curl --request POST \
--url https://economy.synxbr.com/api/v1/payment-requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"bank_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"items": [
{
"payable_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_date": "2023-12-25"
}
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
bank_account_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
items: [
{payable_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', payment_date: '2023-12-25'}
]
})
};
fetch('https://economy.synxbr.com/api/v1/payment-requests', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://economy.synxbr.com/api/v1/payment-requests"
payload = {
"bank_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"items": [
{
"payable_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_date": "2023-12-25"
}
]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://economy.synxbr.com/api/v1/payment-requests",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bank_account_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'items' => [
[
'payable_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'payment_date' => '2023-12-25'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "awaiting_approval",
"bank_account": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"total_amount": "1234.56",
"items_count": 123,
"rejection_reason": "<string>",
"approved_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"items": [
{
"payable": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"type": "bank_slip",
"payment_date": "2023-12-25",
"amount": "1234.56",
"bank_status": "sent",
"bank_message": "<string>",
"paid_on": "2023-12-25"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"meta": {
"request_id": "<string>",
"installments": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"generated_titles": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}Pede o pagamento de contas a pagar (o lote espera a aprovação de uma pessoa).
O lote nasce SEMPRE awaiting_approval: quem aprova é uma pessoa com a permissão de aprovar pagamentos e a verificação em duas etapas, na tela do SynX — a API nunca aprova nem envia dinheiro sozinha. As regras de cada conta são as da tela (situação, conta já em outro lote, data, como pagar). Só em conta com envio direto ao banco habilitado e que já fez um lote pela tela (account_cannot_transmit, account_setup_incomplete). A rota precisa estar ligada para a empresa pela equipe do SynX (payment_requests_disabled). As mudanças de situação chegam pelo evento payment_request.status_changed.
Permissão exigida: Criar pagamentos (payments.create).
curl --request POST \
--url https://economy.synxbr.com/api/v1/payment-requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"bank_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"items": [
{
"payable_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_date": "2023-12-25"
}
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
bank_account_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
items: [
{payable_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', payment_date: '2023-12-25'}
]
})
};
fetch('https://economy.synxbr.com/api/v1/payment-requests', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://economy.synxbr.com/api/v1/payment-requests"
payload = {
"bank_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"items": [
{
"payable_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_date": "2023-12-25"
}
]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://economy.synxbr.com/api/v1/payment-requests",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bank_account_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'items' => [
[
'payable_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'payment_date' => '2023-12-25'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "awaiting_approval",
"bank_account": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"total_amount": "1234.56",
"items_count": 123,
"rejection_reason": "<string>",
"approved_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"items": [
{
"payable": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"type": "bank_slip",
"payment_date": "2023-12-25",
"amount": "1234.56",
"bank_status": "sent",
"bank_message": "<string>",
"paid_on": "2023-12-25"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"meta": {
"request_id": "<string>",
"installments": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"generated_titles": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"fields": {},
"required_permissions": [
"<string>"
]
}
}Autorizações
Cabeçalhos
Um identificador único deste pedido (um UUID serve), de 8 a 100 caracteres. Repetir o pedido com a mesma chave devolve a mesma resposta, sem criar outro registro (24 h); a mesma chave com outro conteúdo é recusada (422). A resposta repetida vem com o cabeçalho Idempotent-Replayed: true.
8 - 100Corpo
Resposta
O lote (quando o banco separa Pix do resto, o primeiro; todos em meta.payment_requests).