curl --request POST \
--url https://api-global.fastpaybrasil.com/v1/charges \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 10,
"currency": "USD",
"customer": {
"id": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"name": "John Doe",
"email": "[email protected]",
"phone": "+1234567890",
"document": {
"type": "dni",
"id": "12345678900"
},
"address": {
"country": "USA"
},
"ipAddress": "127.0.0.1"
},
"paymentMethod": {
"type": "credit_card",
"number": "1111222233334444",
"holderName": "John Doe",
"expirationMonth": "10",
"expirationYear": "2025",
"cvv": "123",
"installments": 1,
"threeDSMode": "managed"
},
"items": [
{
"title": "Shoes",
"description": "Nike Shoes",
"unit_price": 199.99,
"quantity": 1
}
],
"trackingInfo": {
"trackingCode": "TRK123456789",
"shippingProvider": "FedEx",
"trackingUrl": "https://tracking.com/TRK123456789",
"trackingStatus": "on_the_way"
},
"metadata": {
"order_id": "ORD-123",
"product_id": "PROD-456"
},
"postbackUrl": "https://merchant.com/webhooks/charge-status",
"split": [
{
"merchantId": "2vorkDcXyvzifL63YX09S9VqcnI",
"percentage": 10
}
]
}
'import requests
url = "https://api-global.fastpaybrasil.com/v1/charges"
payload = {
"amount": 10,
"currency": "USD",
"customer": {
"id": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"name": "John Doe",
"email": "[email protected]",
"phone": "+1234567890",
"document": {
"type": "dni",
"id": "12345678900"
},
"address": { "country": "USA" },
"ipAddress": "127.0.0.1"
},
"paymentMethod": {
"type": "credit_card",
"number": "1111222233334444",
"holderName": "John Doe",
"expirationMonth": "10",
"expirationYear": "2025",
"cvv": "123",
"installments": 1,
"threeDSMode": "managed"
},
"items": [
{
"title": "Shoes",
"description": "Nike Shoes",
"unit_price": 199.99,
"quantity": 1
}
],
"trackingInfo": {
"trackingCode": "TRK123456789",
"shippingProvider": "FedEx",
"trackingUrl": "https://tracking.com/TRK123456789",
"trackingStatus": "on_the_way"
},
"metadata": {
"order_id": "ORD-123",
"product_id": "PROD-456"
},
"postbackUrl": "https://merchant.com/webhooks/charge-status",
"split": [
{
"merchantId": "2vorkDcXyvzifL63YX09S9VqcnI",
"percentage": 10
}
]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 10,
currency: 'USD',
customer: {
id: '2RhQg9M7ZCg3X3nMb9W1kX8Q',
name: 'John Doe',
email: '[email protected]',
phone: '+1234567890',
document: {type: 'dni', id: '12345678900'},
address: {country: 'USA'},
ipAddress: '127.0.0.1'
},
paymentMethod: {
type: 'credit_card',
number: '1111222233334444',
holderName: 'John Doe',
expirationMonth: '10',
expirationYear: '2025',
cvv: '123',
installments: 1,
threeDSMode: 'managed'
},
items: [{title: 'Shoes', description: 'Nike Shoes', unit_price: 199.99, quantity: 1}],
trackingInfo: {
trackingCode: 'TRK123456789',
shippingProvider: 'FedEx',
trackingUrl: 'https://tracking.com/TRK123456789',
trackingStatus: 'on_the_way'
},
metadata: {order_id: 'ORD-123', product_id: 'PROD-456'},
postbackUrl: 'https://merchant.com/webhooks/charge-status',
split: [{merchantId: '2vorkDcXyvzifL63YX09S9VqcnI', percentage: 10}]
})
};
fetch('https://api-global.fastpaybrasil.com/v1/charges', 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-global.fastpaybrasil.com/v1/charges",
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([
'amount' => 10,
'currency' => 'USD',
'customer' => [
'id' => '2RhQg9M7ZCg3X3nMb9W1kX8Q',
'name' => 'John Doe',
'email' => '[email protected]',
'phone' => '+1234567890',
'document' => [
'type' => 'dni',
'id' => '12345678900'
],
'address' => [
'country' => 'USA'
],
'ipAddress' => '127.0.0.1'
],
'paymentMethod' => [
'type' => 'credit_card',
'number' => '1111222233334444',
'holderName' => 'John Doe',
'expirationMonth' => '10',
'expirationYear' => '2025',
'cvv' => '123',
'installments' => 1,
'threeDSMode' => 'managed'
],
'items' => [
[
'title' => 'Shoes',
'description' => 'Nike Shoes',
'unit_price' => 199.99,
'quantity' => 1
]
],
'trackingInfo' => [
'trackingCode' => 'TRK123456789',
'shippingProvider' => 'FedEx',
'trackingUrl' => 'https://tracking.com/TRK123456789',
'trackingStatus' => 'on_the_way'
],
'metadata' => [
'order_id' => 'ORD-123',
'product_id' => 'PROD-456'
],
'postbackUrl' => 'https://merchant.com/webhooks/charge-status',
'split' => [
[
'merchantId' => '2vorkDcXyvzifL63YX09S9VqcnI',
'percentage' => 10
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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-global.fastpaybrasil.com/v1/charges"
payload := strings.NewReader("{\n \"amount\": 10,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"document\": {\n \"type\": \"dni\",\n \"id\": \"12345678900\"\n },\n \"address\": {\n \"country\": \"USA\"\n },\n \"ipAddress\": \"127.0.0.1\"\n },\n \"paymentMethod\": {\n \"type\": \"credit_card\",\n \"number\": \"1111222233334444\",\n \"holderName\": \"John Doe\",\n \"expirationMonth\": \"10\",\n \"expirationYear\": \"2025\",\n \"cvv\": \"123\",\n \"installments\": 1,\n \"threeDSMode\": \"managed\"\n },\n \"items\": [\n {\n \"title\": \"Shoes\",\n \"description\": \"Nike Shoes\",\n \"unit_price\": 199.99,\n \"quantity\": 1\n }\n ],\n \"trackingInfo\": {\n \"trackingCode\": \"TRK123456789\",\n \"shippingProvider\": \"FedEx\",\n \"trackingUrl\": \"https://tracking.com/TRK123456789\",\n \"trackingStatus\": \"on_the_way\"\n },\n \"metadata\": {\n \"order_id\": \"ORD-123\",\n \"product_id\": \"PROD-456\"\n },\n \"postbackUrl\": \"https://merchant.com/webhooks/charge-status\",\n \"split\": [\n {\n \"merchantId\": \"2vorkDcXyvzifL63YX09S9VqcnI\",\n \"percentage\": 10\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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-global.fastpaybrasil.com/v1/charges")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 10,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"document\": {\n \"type\": \"dni\",\n \"id\": \"12345678900\"\n },\n \"address\": {\n \"country\": \"USA\"\n },\n \"ipAddress\": \"127.0.0.1\"\n },\n \"paymentMethod\": {\n \"type\": \"credit_card\",\n \"number\": \"1111222233334444\",\n \"holderName\": \"John Doe\",\n \"expirationMonth\": \"10\",\n \"expirationYear\": \"2025\",\n \"cvv\": \"123\",\n \"installments\": 1,\n \"threeDSMode\": \"managed\"\n },\n \"items\": [\n {\n \"title\": \"Shoes\",\n \"description\": \"Nike Shoes\",\n \"unit_price\": 199.99,\n \"quantity\": 1\n }\n ],\n \"trackingInfo\": {\n \"trackingCode\": \"TRK123456789\",\n \"shippingProvider\": \"FedEx\",\n \"trackingUrl\": \"https://tracking.com/TRK123456789\",\n \"trackingStatus\": \"on_the_way\"\n },\n \"metadata\": {\n \"order_id\": \"ORD-123\",\n \"product_id\": \"PROD-456\"\n },\n \"postbackUrl\": \"https://merchant.com/webhooks/charge-status\",\n \"split\": [\n {\n \"merchantId\": \"2vorkDcXyvzifL63YX09S9VqcnI\",\n \"percentage\": 10\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-global.fastpaybrasil.com/v1/charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 10,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"document\": {\n \"type\": \"dni\",\n \"id\": \"12345678900\"\n },\n \"address\": {\n \"country\": \"USA\"\n },\n \"ipAddress\": \"127.0.0.1\"\n },\n \"paymentMethod\": {\n \"type\": \"credit_card\",\n \"number\": \"1111222233334444\",\n \"holderName\": \"John Doe\",\n \"expirationMonth\": \"10\",\n \"expirationYear\": \"2025\",\n \"cvv\": \"123\",\n \"installments\": 1,\n \"threeDSMode\": \"managed\"\n },\n \"items\": [\n {\n \"title\": \"Shoes\",\n \"description\": \"Nike Shoes\",\n \"unit_price\": 199.99,\n \"quantity\": 1\n }\n ],\n \"trackingInfo\": {\n \"trackingCode\": \"TRK123456789\",\n \"shippingProvider\": \"FedEx\",\n \"trackingUrl\": \"https://tracking.com/TRK123456789\",\n \"trackingStatus\": \"on_the_way\"\n },\n \"metadata\": {\n \"order_id\": \"ORD-123\",\n \"product_id\": \"PROD-456\"\n },\n \"postbackUrl\": \"https://merchant.com/webhooks/charge-status\",\n \"split\": [\n {\n \"merchantId\": \"2vorkDcXyvzifL63YX09S9VqcnI\",\n \"percentage\": 10\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "2vorkDcXyvzifL63YX09S9VqcnI",
"status": "pending",
"paymentDetails": {
"firstSix": "123456",
"lastFour": "7890",
"expirationMonth": "08",
"expirationYear": "2024",
"holderName": "John Doe",
"installments": 3
},
"reason": "Insufficient funds"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 403,
"message": "Forbidden"
}{
"statusCode": 422,
"error": "Unprocessable Entity",
"message": "The items list contains one of more items with invalid type."
}{
"statusCode": 500,
"message": "Internal server error"
}Create a new charge
Creates a payment charge for a merchant with the specified amount, currency, and payment method.
curl --request POST \
--url https://api-global.fastpaybrasil.com/v1/charges \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 10,
"currency": "USD",
"customer": {
"id": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"name": "John Doe",
"email": "[email protected]",
"phone": "+1234567890",
"document": {
"type": "dni",
"id": "12345678900"
},
"address": {
"country": "USA"
},
"ipAddress": "127.0.0.1"
},
"paymentMethod": {
"type": "credit_card",
"number": "1111222233334444",
"holderName": "John Doe",
"expirationMonth": "10",
"expirationYear": "2025",
"cvv": "123",
"installments": 1,
"threeDSMode": "managed"
},
"items": [
{
"title": "Shoes",
"description": "Nike Shoes",
"unit_price": 199.99,
"quantity": 1
}
],
"trackingInfo": {
"trackingCode": "TRK123456789",
"shippingProvider": "FedEx",
"trackingUrl": "https://tracking.com/TRK123456789",
"trackingStatus": "on_the_way"
},
"metadata": {
"order_id": "ORD-123",
"product_id": "PROD-456"
},
"postbackUrl": "https://merchant.com/webhooks/charge-status",
"split": [
{
"merchantId": "2vorkDcXyvzifL63YX09S9VqcnI",
"percentage": 10
}
]
}
'import requests
url = "https://api-global.fastpaybrasil.com/v1/charges"
payload = {
"amount": 10,
"currency": "USD",
"customer": {
"id": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"name": "John Doe",
"email": "[email protected]",
"phone": "+1234567890",
"document": {
"type": "dni",
"id": "12345678900"
},
"address": { "country": "USA" },
"ipAddress": "127.0.0.1"
},
"paymentMethod": {
"type": "credit_card",
"number": "1111222233334444",
"holderName": "John Doe",
"expirationMonth": "10",
"expirationYear": "2025",
"cvv": "123",
"installments": 1,
"threeDSMode": "managed"
},
"items": [
{
"title": "Shoes",
"description": "Nike Shoes",
"unit_price": 199.99,
"quantity": 1
}
],
"trackingInfo": {
"trackingCode": "TRK123456789",
"shippingProvider": "FedEx",
"trackingUrl": "https://tracking.com/TRK123456789",
"trackingStatus": "on_the_way"
},
"metadata": {
"order_id": "ORD-123",
"product_id": "PROD-456"
},
"postbackUrl": "https://merchant.com/webhooks/charge-status",
"split": [
{
"merchantId": "2vorkDcXyvzifL63YX09S9VqcnI",
"percentage": 10
}
]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 10,
currency: 'USD',
customer: {
id: '2RhQg9M7ZCg3X3nMb9W1kX8Q',
name: 'John Doe',
email: '[email protected]',
phone: '+1234567890',
document: {type: 'dni', id: '12345678900'},
address: {country: 'USA'},
ipAddress: '127.0.0.1'
},
paymentMethod: {
type: 'credit_card',
number: '1111222233334444',
holderName: 'John Doe',
expirationMonth: '10',
expirationYear: '2025',
cvv: '123',
installments: 1,
threeDSMode: 'managed'
},
items: [{title: 'Shoes', description: 'Nike Shoes', unit_price: 199.99, quantity: 1}],
trackingInfo: {
trackingCode: 'TRK123456789',
shippingProvider: 'FedEx',
trackingUrl: 'https://tracking.com/TRK123456789',
trackingStatus: 'on_the_way'
},
metadata: {order_id: 'ORD-123', product_id: 'PROD-456'},
postbackUrl: 'https://merchant.com/webhooks/charge-status',
split: [{merchantId: '2vorkDcXyvzifL63YX09S9VqcnI', percentage: 10}]
})
};
fetch('https://api-global.fastpaybrasil.com/v1/charges', 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-global.fastpaybrasil.com/v1/charges",
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([
'amount' => 10,
'currency' => 'USD',
'customer' => [
'id' => '2RhQg9M7ZCg3X3nMb9W1kX8Q',
'name' => 'John Doe',
'email' => '[email protected]',
'phone' => '+1234567890',
'document' => [
'type' => 'dni',
'id' => '12345678900'
],
'address' => [
'country' => 'USA'
],
'ipAddress' => '127.0.0.1'
],
'paymentMethod' => [
'type' => 'credit_card',
'number' => '1111222233334444',
'holderName' => 'John Doe',
'expirationMonth' => '10',
'expirationYear' => '2025',
'cvv' => '123',
'installments' => 1,
'threeDSMode' => 'managed'
],
'items' => [
[
'title' => 'Shoes',
'description' => 'Nike Shoes',
'unit_price' => 199.99,
'quantity' => 1
]
],
'trackingInfo' => [
'trackingCode' => 'TRK123456789',
'shippingProvider' => 'FedEx',
'trackingUrl' => 'https://tracking.com/TRK123456789',
'trackingStatus' => 'on_the_way'
],
'metadata' => [
'order_id' => 'ORD-123',
'product_id' => 'PROD-456'
],
'postbackUrl' => 'https://merchant.com/webhooks/charge-status',
'split' => [
[
'merchantId' => '2vorkDcXyvzifL63YX09S9VqcnI',
'percentage' => 10
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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-global.fastpaybrasil.com/v1/charges"
payload := strings.NewReader("{\n \"amount\": 10,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"document\": {\n \"type\": \"dni\",\n \"id\": \"12345678900\"\n },\n \"address\": {\n \"country\": \"USA\"\n },\n \"ipAddress\": \"127.0.0.1\"\n },\n \"paymentMethod\": {\n \"type\": \"credit_card\",\n \"number\": \"1111222233334444\",\n \"holderName\": \"John Doe\",\n \"expirationMonth\": \"10\",\n \"expirationYear\": \"2025\",\n \"cvv\": \"123\",\n \"installments\": 1,\n \"threeDSMode\": \"managed\"\n },\n \"items\": [\n {\n \"title\": \"Shoes\",\n \"description\": \"Nike Shoes\",\n \"unit_price\": 199.99,\n \"quantity\": 1\n }\n ],\n \"trackingInfo\": {\n \"trackingCode\": \"TRK123456789\",\n \"shippingProvider\": \"FedEx\",\n \"trackingUrl\": \"https://tracking.com/TRK123456789\",\n \"trackingStatus\": \"on_the_way\"\n },\n \"metadata\": {\n \"order_id\": \"ORD-123\",\n \"product_id\": \"PROD-456\"\n },\n \"postbackUrl\": \"https://merchant.com/webhooks/charge-status\",\n \"split\": [\n {\n \"merchantId\": \"2vorkDcXyvzifL63YX09S9VqcnI\",\n \"percentage\": 10\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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-global.fastpaybrasil.com/v1/charges")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 10,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"document\": {\n \"type\": \"dni\",\n \"id\": \"12345678900\"\n },\n \"address\": {\n \"country\": \"USA\"\n },\n \"ipAddress\": \"127.0.0.1\"\n },\n \"paymentMethod\": {\n \"type\": \"credit_card\",\n \"number\": \"1111222233334444\",\n \"holderName\": \"John Doe\",\n \"expirationMonth\": \"10\",\n \"expirationYear\": \"2025\",\n \"cvv\": \"123\",\n \"installments\": 1,\n \"threeDSMode\": \"managed\"\n },\n \"items\": [\n {\n \"title\": \"Shoes\",\n \"description\": \"Nike Shoes\",\n \"unit_price\": 199.99,\n \"quantity\": 1\n }\n ],\n \"trackingInfo\": {\n \"trackingCode\": \"TRK123456789\",\n \"shippingProvider\": \"FedEx\",\n \"trackingUrl\": \"https://tracking.com/TRK123456789\",\n \"trackingStatus\": \"on_the_way\"\n },\n \"metadata\": {\n \"order_id\": \"ORD-123\",\n \"product_id\": \"PROD-456\"\n },\n \"postbackUrl\": \"https://merchant.com/webhooks/charge-status\",\n \"split\": [\n {\n \"merchantId\": \"2vorkDcXyvzifL63YX09S9VqcnI\",\n \"percentage\": 10\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-global.fastpaybrasil.com/v1/charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 10,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"document\": {\n \"type\": \"dni\",\n \"id\": \"12345678900\"\n },\n \"address\": {\n \"country\": \"USA\"\n },\n \"ipAddress\": \"127.0.0.1\"\n },\n \"paymentMethod\": {\n \"type\": \"credit_card\",\n \"number\": \"1111222233334444\",\n \"holderName\": \"John Doe\",\n \"expirationMonth\": \"10\",\n \"expirationYear\": \"2025\",\n \"cvv\": \"123\",\n \"installments\": 1,\n \"threeDSMode\": \"managed\"\n },\n \"items\": [\n {\n \"title\": \"Shoes\",\n \"description\": \"Nike Shoes\",\n \"unit_price\": 199.99,\n \"quantity\": 1\n }\n ],\n \"trackingInfo\": {\n \"trackingCode\": \"TRK123456789\",\n \"shippingProvider\": \"FedEx\",\n \"trackingUrl\": \"https://tracking.com/TRK123456789\",\n \"trackingStatus\": \"on_the_way\"\n },\n \"metadata\": {\n \"order_id\": \"ORD-123\",\n \"product_id\": \"PROD-456\"\n },\n \"postbackUrl\": \"https://merchant.com/webhooks/charge-status\",\n \"split\": [\n {\n \"merchantId\": \"2vorkDcXyvzifL63YX09S9VqcnI\",\n \"percentage\": 10\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "2vorkDcXyvzifL63YX09S9VqcnI",
"status": "pending",
"paymentDetails": {
"firstSix": "123456",
"lastFour": "7890",
"expirationMonth": "08",
"expirationYear": "2024",
"holderName": "John Doe",
"installments": 3
},
"reason": "Insufficient funds"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 403,
"message": "Forbidden"
}{
"statusCode": 422,
"error": "Unprocessable Entity",
"message": "The items list contains one of more items with invalid type."
}{
"statusCode": 500,
"message": "Internal server error"
}Authorizations
HTTP Basic authentication. Use your secret key as the username and an empty string as password. The API key should be base64 encoded in the format 'username:' when sending the Authorization header.
Body
The amount to charge in the currency unit, not cents. (e.g., 10 for 10 BRL)
x >= 110
The ISO 4217 currency code. (e.g., BRL, USD, EUR)
"USD"
Customer data. Provide id to reference an existing customer (all other
fields become optional), or provide name + email (or phone) to
create/look up a customer inline.
Show child attributes
Show child attributes
- Credit Card
- Credit Card (with saved card)
- Credit Card (with Apple Pay wallet)
- Pix
- Pix Open Finance
- PSE
- Voucher
- Bank Transfer
- Rapipago
- Khipu
- QRCode
Show child attributes
Show child attributes
List of charge items.
Show child attributes
Show child attributes
Shipping address details. Required for merchants selling physical goods.
Show child attributes
Show child attributes
Shipping tracking details.
Show child attributes
Show child attributes
Additional metadata to store with the charge.
{
"order_id": "ORD-123",
"product_id": "PROD-456"
}
Optional URL that receives asynchronous webhook notifications for the charge's lifecycle events AFTER creation. This URL is NOT used for the synchronous create response.
Events delivered to this URL:
- PIX charges:
charge.pending(QR code created),charge.paid - Credit card charges:
charge.paid,charge.refunded,charge.updated
The payload format is identical to the registered webhook endpoint
format (id, event, livemode, data with the full charge object).
Retry logic applies the same exponential backoff as endpoint webhooks.
"https://merchant.com/webhooks/charge-status"
Array of merchants and percentages participating in Split
Show child attributes
Show child attributes
Response
The charge has been successfully created
The unique identifier of the created charge
"2vorkDcXyvzifL63YX09S9VqcnI"
The status of the charge
paid, pending, refused, failed "pending"
Additional payment details specific to the payment method
- Credit Card
- Rapipago
- Khipu
- Pix
- QRCode
Show child attributes
Show child attributes
The reason for charge status (especially for refused charges)
"Insufficient funds"