Skip to main content
POST
/
v2
/
transactions
Create a Transaction
curl --request POST \
  --url https://api.pagou.ai/v2/transactions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "amount": 50000000,
  "method": "pix",
  "buyer": {
    "id": 0,
    "name": "<string>",
    "email": "jsmith@example.com",
    "phone": "<string>",
    "birth_date": "<string>",
    "document": {
      "number": "<string>"
    },
    "address": {
      "street": "<string>",
      "city": "<string>",
      "number": "<string>",
      "complement": "<string>",
      "neighborhood": "<string>",
      "state": "<string>",
      "zipCode": "<string>",
      "country": "BR"
    }
  },
  "products": [
    {
      "name": "<string>",
      "price": 50000000,
      "quantity": 1,
      "tangible": false,
      "sku": "<string>"
    }
  ],
  "external_ref": "<string>",
  "currency": "BRL",
  "installments": 6,
  "interest_rate": 50,
  "token": "<string>",
  "notify_url": "<string>",
  "metadata": "<string>",
  "traceable": false,
  "ip_address": "127.0.0.1"
}
'
import requests

url = "https://api.pagou.ai/v2/transactions"

payload = {
"amount": 50000000,
"method": "pix",
"buyer": {
"id": 0,
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"birth_date": "<string>",
"document": { "number": "<string>" },
"address": {
"street": "<string>",
"city": "<string>",
"number": "<string>",
"complement": "<string>",
"neighborhood": "<string>",
"state": "<string>",
"zipCode": "<string>",
"country": "BR"
}
},
"products": [
{
"name": "<string>",
"price": 50000000,
"quantity": 1,
"tangible": False,
"sku": "<string>"
}
],
"external_ref": "<string>",
"currency": "BRL",
"installments": 6,
"interest_rate": 50,
"token": "<string>",
"notify_url": "<string>",
"metadata": "<string>",
"traceable": False,
"ip_address": "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({
amount: 50000000,
method: 'pix',
buyer: {
id: 0,
name: '<string>',
email: 'jsmith@example.com',
phone: '<string>',
birth_date: '<string>',
document: {number: '<string>'},
address: {
street: '<string>',
city: '<string>',
number: '<string>',
complement: '<string>',
neighborhood: '<string>',
state: '<string>',
zipCode: '<string>',
country: 'BR'
}
},
products: [
{
name: '<string>',
price: 50000000,
quantity: 1,
tangible: false,
sku: '<string>'
}
],
external_ref: '<string>',
currency: 'BRL',
installments: 6,
interest_rate: 50,
token: '<string>',
notify_url: '<string>',
metadata: '<string>',
traceable: false,
ip_address: '127.0.0.1'
})
};

fetch('https://api.pagou.ai/v2/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.pagou.ai/v2/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([
'amount' => 50000000,
'method' => 'pix',
'buyer' => [
'id' => 0,
'name' => '<string>',
'email' => 'jsmith@example.com',
'phone' => '<string>',
'birth_date' => '<string>',
'document' => [
'number' => '<string>'
],
'address' => [
'street' => '<string>',
'city' => '<string>',
'number' => '<string>',
'complement' => '<string>',
'neighborhood' => '<string>',
'state' => '<string>',
'zipCode' => '<string>',
'country' => 'BR'
]
],
'products' => [
[
'name' => '<string>',
'price' => 50000000,
'quantity' => 1,
'tangible' => false,
'sku' => '<string>'
]
],
'external_ref' => '<string>',
'currency' => 'BRL',
'installments' => 6,
'interest_rate' => 50,
'token' => '<string>',
'notify_url' => '<string>',
'metadata' => '<string>',
'traceable' => false,
'ip_address' => '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.pagou.ai/v2/transactions"

payload := strings.NewReader("{\n \"amount\": 50000000,\n \"method\": \"pix\",\n \"buyer\": {\n \"id\": 0,\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\",\n \"birth_date\": \"<string>\",\n \"document\": {\n \"number\": \"<string>\"\n },\n \"address\": {\n \"street\": \"<string>\",\n \"city\": \"<string>\",\n \"number\": \"<string>\",\n \"complement\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"country\": \"BR\"\n }\n },\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": 50000000,\n \"quantity\": 1,\n \"tangible\": false,\n \"sku\": \"<string>\"\n }\n ],\n \"external_ref\": \"<string>\",\n \"currency\": \"BRL\",\n \"installments\": 6,\n \"interest_rate\": 50,\n \"token\": \"<string>\",\n \"notify_url\": \"<string>\",\n \"metadata\": \"<string>\",\n \"traceable\": false,\n \"ip_address\": \"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.pagou.ai/v2/transactions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 50000000,\n \"method\": \"pix\",\n \"buyer\": {\n \"id\": 0,\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\",\n \"birth_date\": \"<string>\",\n \"document\": {\n \"number\": \"<string>\"\n },\n \"address\": {\n \"street\": \"<string>\",\n \"city\": \"<string>\",\n \"number\": \"<string>\",\n \"complement\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"country\": \"BR\"\n }\n },\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": 50000000,\n \"quantity\": 1,\n \"tangible\": false,\n \"sku\": \"<string>\"\n }\n ],\n \"external_ref\": \"<string>\",\n \"currency\": \"BRL\",\n \"installments\": 6,\n \"interest_rate\": 50,\n \"token\": \"<string>\",\n \"notify_url\": \"<string>\",\n \"metadata\": \"<string>\",\n \"traceable\": false,\n \"ip_address\": \"127.0.0.1\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.pagou.ai/v2/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 \"amount\": 50000000,\n \"method\": \"pix\",\n \"buyer\": {\n \"id\": 0,\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\",\n \"birth_date\": \"<string>\",\n \"document\": {\n \"number\": \"<string>\"\n },\n \"address\": {\n \"street\": \"<string>\",\n \"city\": \"<string>\",\n \"number\": \"<string>\",\n \"complement\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"country\": \"BR\"\n }\n },\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": 50000000,\n \"quantity\": 1,\n \"tangible\": false,\n \"sku\": \"<string>\"\n }\n ],\n \"external_ref\": \"<string>\",\n \"currency\": \"BRL\",\n \"installments\": 6,\n \"interest_rate\": 50,\n \"token\": \"<string>\",\n \"notify_url\": \"<string>\",\n \"metadata\": \"<string>\",\n \"traceable\": false,\n \"ip_address\": \"127.0.0.1\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "requestId": "<string>",
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "amount": 50000050,
    "currency": "BRL",
    "buyer": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>",
      "email": "jsmith@example.com",
      "phone": "<string>",
      "birth_date": "<string>",
      "document": {
        "number": "<string>"
      },
      "address": {
        "street": "<string>",
        "city": "<string>",
        "country": "BR",
        "number": "<string>",
        "complement": "<string>",
        "neighborhood": "<string>",
        "state": "<string>",
        "zipCode": "<string>"
      }
    },
    "fee": {
      "net_amount": 50000000,
      "estimated_fee": 50000000
    },
    "informations": [
      {
        "key": "<string>",
        "value": "<string>"
      }
    ],
    "paid_amount": 50000000,
    "method": "pix",
    "refunded_amount": 50000000,
    "products": [
      {
        "name": "<string>",
        "price": 50000000,
        "quantity": 500000
      }
    ],
    "traceable": true,
    "splits": [
      {
        "recipient_id": 0,
        "amount": 50000000,
        "charge_processing_fee": true
      }
    ],
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "voucher": {
      "barcode": "<string>",
      "digitable_line": "<string>",
      "url": "<string>",
      "expiration_date": "2023-11-07T05:31:56Z",
      "instructions": "<string>",
      "receipt_url": "<string>"
    },
    "external_ref": "<string>",
    "installments": 6,
    "paid_at": "2023-11-07T05:31:56Z",
    "pix": {
      "qr_code": "<string>",
      "expiration_date": "2023-11-07T05:31:56Z",
      "end_to_end_id": "<string>",
      "receipt_url": "<string>"
    },
    "metadata": {},
    "ip_address": "127.0.0.1",
    "next_action": {
      "type": "three_ds_challenge",
      "challenge_session_id": "<string>",
      "client_secret": "<string>",
      "expires_at": "2023-11-07T05:31:56Z"
    }
  }
}
{
"error": "DUPLICATE_EXTERNAL_REF",
"message": "A transaction with this external reference already exists",
"status": 409
}
{
"error": "<string>",
"message": "<string>",
"status": 422
}
{
"error": "<string>",
"message": "<string>",
"status": 500
}
{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}

Voucher payments

Use method: "voucher" for local payment instructions such as Boleto, SPEI, Mercado Pago, Webpay, CODI, and PSE. Do not send provider-specific method names to this endpoint. For the complete voucher flow, supported countries, document types, and response-field guidance, see Accept Voucher Payments.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
amount
integer
required
Required range: 0 < x <= 100000000
method
enum<string>
default:pix
required

Payment method to be used for the transaction.

Available options:
pix,
voucher,
credit_card
buyer
object
required

Buyer information for the transaction.

products
object[]
required

List of products associated with the transaction.

Required array length: 1 - 100 elements
external_ref
string | null

Optional idempotency key or external reference from your system.

currency
enum<string>
default:BRL

Transaction currency. Defaults to BRL.

Available options:
ARS,
BOB,
BRL,
CLP,
COP,
CRC,
GTQ,
MXN,
PYG,
PEN,
USD,
UYU
installments
integer | null

Number of installments for the transaction when applicable.

Required range: 1 <= x <= 12
interest_rate
number | null

Installment interest rate (%) embedded in the charged amount, when applicable.

Required range: 0 <= x <= 100
token
string

Optional payment token for card transactions. Use 'pgct_' for single-use or 'pgpm_' for reusable (upsell) tokens.

Pattern: ^(pgct_|pgpm_)
notify_url
string | null

Optional HTTPS URL to receive webhooks for this transaction.

Maximum string length: 2048
metadata
string | null

Optional metadata string for your own reference.

traceable
boolean
default:false

Whether the transaction should be traceable for fraud or risk analysis.

ip_address

IPv4 or IPv6 address of the buyer or request origin.

Pattern: ^(?:(?: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])$

Response

HTTP 201 response

success
boolean
required
requestId
string
required
data
object
required