Criar cobrança
Cria uma nova transação de pagamento. Aceita o header opcional Idempotency-Key para repetição segura — a resposta 2xx original é replayada por 1 hora (com o header x-idempotent-replayed); requisição em voo com a mesma chave retorna 409; reusar a chave com body diferente retorna 422.
curl --request POST \
--url https://api.payments.bob.company/api/v1/transactions/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {
"name": "<string>",
"document": "<string>",
"email": "[email protected]",
"phone": "<string>",
"address": {
"street": "<string>",
"streetNumber": "<string>",
"neighborhood": "<string>",
"zipCode": "<string>",
"city": "<string>",
"state": "<string>",
"complement": "<string>",
"country": "BR"
}
},
"payment": {
"amountCents": 25000000,
"product": "<string>",
"quantity": 1,
"expirationDays": 15
},
"originDomain": "<string>",
"customerIp": "127.0.0.1"
}
'import requests
url = "https://api.payments.bob.company/api/v1/transactions/"
payload = {
"customer": {
"name": "<string>",
"document": "<string>",
"email": "[email protected]",
"phone": "<string>",
"address": {
"street": "<string>",
"streetNumber": "<string>",
"neighborhood": "<string>",
"zipCode": "<string>",
"city": "<string>",
"state": "<string>",
"complement": "<string>",
"country": "BR"
}
},
"payment": {
"amountCents": 25000000,
"product": "<string>",
"quantity": 1,
"expirationDays": 15
},
"originDomain": "<string>",
"customerIp": "127.0.0.1"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: {
name: '<string>',
document: '<string>',
email: '[email protected]',
phone: '<string>',
address: {
street: '<string>',
streetNumber: '<string>',
neighborhood: '<string>',
zipCode: '<string>',
city: '<string>',
state: '<string>',
complement: '<string>',
country: 'BR'
}
},
payment: {amountCents: 25000000, product: '<string>', quantity: 1, expirationDays: 15},
originDomain: '<string>',
customerIp: '127.0.0.1'
})
};
fetch('https://api.payments.bob.company/api/v1/transactions/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.payments.bob.company/api/v1/transactions/",
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([
'customer' => [
'name' => '<string>',
'document' => '<string>',
'email' => '[email protected]',
'phone' => '<string>',
'address' => [
'street' => '<string>',
'streetNumber' => '<string>',
'neighborhood' => '<string>',
'zipCode' => '<string>',
'city' => '<string>',
'state' => '<string>',
'complement' => '<string>',
'country' => 'BR'
]
],
'payment' => [
'amountCents' => 25000000,
'product' => '<string>',
'quantity' => 1,
'expirationDays' => 15
],
'originDomain' => '<string>',
'customerIp' => '127.0.0.1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.payments.bob.company/api/v1/transactions/"
payload := strings.NewReader("{\n \"customer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"address\": {\n \"street\": \"<string>\",\n \"streetNumber\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"complement\": \"<string>\",\n \"country\": \"BR\"\n }\n },\n \"payment\": {\n \"amountCents\": 25000000,\n \"product\": \"<string>\",\n \"quantity\": 1,\n \"expirationDays\": 15\n },\n \"originDomain\": \"<string>\",\n \"customerIp\": \"127.0.0.1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.payments.bob.company/api/v1/transactions/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"address\": {\n \"street\": \"<string>\",\n \"streetNumber\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"complement\": \"<string>\",\n \"country\": \"BR\"\n }\n },\n \"payment\": {\n \"amountCents\": 25000000,\n \"product\": \"<string>\",\n \"quantity\": 1,\n \"expirationDays\": 15\n },\n \"originDomain\": \"<string>\",\n \"customerIp\": \"127.0.0.1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.payments.bob.company/api/v1/transactions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"address\": {\n \"street\": \"<string>\",\n \"streetNumber\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"complement\": \"<string>\",\n \"country\": \"BR\"\n }\n },\n \"payment\": {\n \"amountCents\": 25000000,\n \"product\": \"<string>\",\n \"quantity\": 1,\n \"expirationDays\": 15\n },\n \"originDomain\": \"<string>\",\n \"customerIp\": \"127.0.0.1\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"status": "<string>",
"pixCode": "<string>",
"expirationDate": "<string>"
},
"message": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {
"retryAfterSeconds": 30
}
}Autorizações
Autenticação por API Key usando token SK (sk_live_xxx ou sk_test_xxx). Envie como: Authorization: Bearer sk_live_xxx
Cabeçalhos
Identificador único da operação (até 256 caracteres, ex. UUID ou ID do pedido). Torna a criação segura de repetir em timeout ou falha de rede, sem risco de pagamento duplicado.
256Corpo
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Domínio da loja/site que originou a transação (ex: loja.exemplo.com.br). Obrigatório para rastreio de múltiplas lojas. Use apenas o hostname, sem protocolo ou caminho.
1 - 253IP do usuário final que originou a requisição (IPv4 ou IPv6). Quando informado, é usado para detecção de fraude e bloqueio de IPs.
^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$Esta página foi útil?
curl --request POST \
--url https://api.payments.bob.company/api/v1/transactions/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {
"name": "<string>",
"document": "<string>",
"email": "[email protected]",
"phone": "<string>",
"address": {
"street": "<string>",
"streetNumber": "<string>",
"neighborhood": "<string>",
"zipCode": "<string>",
"city": "<string>",
"state": "<string>",
"complement": "<string>",
"country": "BR"
}
},
"payment": {
"amountCents": 25000000,
"product": "<string>",
"quantity": 1,
"expirationDays": 15
},
"originDomain": "<string>",
"customerIp": "127.0.0.1"
}
'import requests
url = "https://api.payments.bob.company/api/v1/transactions/"
payload = {
"customer": {
"name": "<string>",
"document": "<string>",
"email": "[email protected]",
"phone": "<string>",
"address": {
"street": "<string>",
"streetNumber": "<string>",
"neighborhood": "<string>",
"zipCode": "<string>",
"city": "<string>",
"state": "<string>",
"complement": "<string>",
"country": "BR"
}
},
"payment": {
"amountCents": 25000000,
"product": "<string>",
"quantity": 1,
"expirationDays": 15
},
"originDomain": "<string>",
"customerIp": "127.0.0.1"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: {
name: '<string>',
document: '<string>',
email: '[email protected]',
phone: '<string>',
address: {
street: '<string>',
streetNumber: '<string>',
neighborhood: '<string>',
zipCode: '<string>',
city: '<string>',
state: '<string>',
complement: '<string>',
country: 'BR'
}
},
payment: {amountCents: 25000000, product: '<string>', quantity: 1, expirationDays: 15},
originDomain: '<string>',
customerIp: '127.0.0.1'
})
};
fetch('https://api.payments.bob.company/api/v1/transactions/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.payments.bob.company/api/v1/transactions/",
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([
'customer' => [
'name' => '<string>',
'document' => '<string>',
'email' => '[email protected]',
'phone' => '<string>',
'address' => [
'street' => '<string>',
'streetNumber' => '<string>',
'neighborhood' => '<string>',
'zipCode' => '<string>',
'city' => '<string>',
'state' => '<string>',
'complement' => '<string>',
'country' => 'BR'
]
],
'payment' => [
'amountCents' => 25000000,
'product' => '<string>',
'quantity' => 1,
'expirationDays' => 15
],
'originDomain' => '<string>',
'customerIp' => '127.0.0.1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.payments.bob.company/api/v1/transactions/"
payload := strings.NewReader("{\n \"customer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"address\": {\n \"street\": \"<string>\",\n \"streetNumber\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"complement\": \"<string>\",\n \"country\": \"BR\"\n }\n },\n \"payment\": {\n \"amountCents\": 25000000,\n \"product\": \"<string>\",\n \"quantity\": 1,\n \"expirationDays\": 15\n },\n \"originDomain\": \"<string>\",\n \"customerIp\": \"127.0.0.1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.payments.bob.company/api/v1/transactions/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"address\": {\n \"street\": \"<string>\",\n \"streetNumber\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"complement\": \"<string>\",\n \"country\": \"BR\"\n }\n },\n \"payment\": {\n \"amountCents\": 25000000,\n \"product\": \"<string>\",\n \"quantity\": 1,\n \"expirationDays\": 15\n },\n \"originDomain\": \"<string>\",\n \"customerIp\": \"127.0.0.1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.payments.bob.company/api/v1/transactions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"address\": {\n \"street\": \"<string>\",\n \"streetNumber\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"complement\": \"<string>\",\n \"country\": \"BR\"\n }\n },\n \"payment\": {\n \"amountCents\": 25000000,\n \"product\": \"<string>\",\n \"quantity\": 1,\n \"expirationDays\": 15\n },\n \"originDomain\": \"<string>\",\n \"customerIp\": \"127.0.0.1\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"status": "<string>",
"pixCode": "<string>",
"expirationDate": "<string>"
},
"message": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"detail": "<string>",
"instance": "<string>",
"details": {
"retryAfterSeconds": 30
}
}