Checkout Links
Criar checkout link
Crie um checkout link hospedado a partir de produtos (upsert por external_id) ou de um amount só-valor.
POST
/
v2
/
checkout-links
Create a Checkout Link
curl --request POST \
--url https://api.pagou.ai/v2/checkout-links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 4503599627370496,
"currency": "BRL",
"title": "<string>",
"products": [
{
"external_id": "<string>",
"name": "<string>",
"price": 4503599627370496,
"quantity": 1,
"description": "<string>",
"image_url": "<string>",
"compare_price": 4503599627370496
}
]
}
'import requests
url = "https://api.pagou.ai/v2/checkout-links"
payload = {
"amount": 4503599627370496,
"currency": "BRL",
"title": "<string>",
"products": [
{
"external_id": "<string>",
"name": "<string>",
"price": 4503599627370496,
"quantity": 1,
"description": "<string>",
"image_url": "<string>",
"compare_price": 4503599627370496
}
]
}
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: 4503599627370496,
currency: 'BRL',
title: '<string>',
products: [
{
external_id: '<string>',
name: '<string>',
price: 4503599627370496,
quantity: 1,
description: '<string>',
image_url: '<string>',
compare_price: 4503599627370496
}
]
})
};
fetch('https://api.pagou.ai/v2/checkout-links', 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/checkout-links",
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' => 4503599627370496,
'currency' => 'BRL',
'title' => '<string>',
'products' => [
[
'external_id' => '<string>',
'name' => '<string>',
'price' => 4503599627370496,
'quantity' => 1,
'description' => '<string>',
'image_url' => '<string>',
'compare_price' => 4503599627370496
]
]
]),
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/checkout-links"
payload := strings.NewReader("{\n \"amount\": 4503599627370496,\n \"currency\": \"BRL\",\n \"title\": \"<string>\",\n \"products\": [\n {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 4503599627370496,\n \"quantity\": 1,\n \"description\": \"<string>\",\n \"image_url\": \"<string>\",\n \"compare_price\": 4503599627370496\n }\n ]\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/checkout-links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 4503599627370496,\n \"currency\": \"BRL\",\n \"title\": \"<string>\",\n \"products\": [\n {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 4503599627370496,\n \"quantity\": 1,\n \"description\": \"<string>\",\n \"image_url\": \"<string>\",\n \"compare_price\": 4503599627370496\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pagou.ai/v2/checkout-links")
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\": 4503599627370496,\n \"currency\": \"BRL\",\n \"title\": \"<string>\",\n \"products\": [\n {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 4503599627370496,\n \"quantity\": 1,\n \"description\": \"<string>\",\n \"image_url\": \"<string>\",\n \"compare_price\": 4503599627370496\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"requestId": "0190a2b4-18a7-7de0-9a43-69b7cf261201",
"data": {
"url": "https://example.com"
}
}{
"error": "<string>",
"message": "<string>",
"status": 422
}{
"error": "<string>",
"message": "<string>",
"status": 500
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Envie
products[] (cada um referenciado pelo seu próprio external_id) ou um amount só-valor —
nunca os dois. Os produtos passam por upsert por external_id, então reenviar o mesmo id atualiza o
produto em vez de duplicar. A resposta é a url final do checkout.
Para o guia completo de integração, links só-valor e prompts de IA, veja
Criar checkout links.Autorizações
BearerAuthApiKeyAuthBasicAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Corpo
application/json
Intervalo obrigatório:
1 <= x <= 9007199254740991Opções disponíveis:
BRL, MXN, COP, CLP, ARS, PEN, USD, GTQ, CRC, NIO, PYG, UYU, BOB, PHP, RUB, INR, SAR, AED, KWD, QAR, OMR, KHR, SGD, IDR, KRW, THB, MYR, HKD, CNY, EGP, EUR, GBP, BHD, MAD, AUD, CAD, CHF, NZD, PLN, KZT, UZS, JPY, GLC Required string length:
1 - 255Required array length:
1 - 25 elementsShow child attributes
Show child attributes
⌘I
Create a Checkout Link
curl --request POST \
--url https://api.pagou.ai/v2/checkout-links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 4503599627370496,
"currency": "BRL",
"title": "<string>",
"products": [
{
"external_id": "<string>",
"name": "<string>",
"price": 4503599627370496,
"quantity": 1,
"description": "<string>",
"image_url": "<string>",
"compare_price": 4503599627370496
}
]
}
'import requests
url = "https://api.pagou.ai/v2/checkout-links"
payload = {
"amount": 4503599627370496,
"currency": "BRL",
"title": "<string>",
"products": [
{
"external_id": "<string>",
"name": "<string>",
"price": 4503599627370496,
"quantity": 1,
"description": "<string>",
"image_url": "<string>",
"compare_price": 4503599627370496
}
]
}
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: 4503599627370496,
currency: 'BRL',
title: '<string>',
products: [
{
external_id: '<string>',
name: '<string>',
price: 4503599627370496,
quantity: 1,
description: '<string>',
image_url: '<string>',
compare_price: 4503599627370496
}
]
})
};
fetch('https://api.pagou.ai/v2/checkout-links', 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/checkout-links",
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' => 4503599627370496,
'currency' => 'BRL',
'title' => '<string>',
'products' => [
[
'external_id' => '<string>',
'name' => '<string>',
'price' => 4503599627370496,
'quantity' => 1,
'description' => '<string>',
'image_url' => '<string>',
'compare_price' => 4503599627370496
]
]
]),
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/checkout-links"
payload := strings.NewReader("{\n \"amount\": 4503599627370496,\n \"currency\": \"BRL\",\n \"title\": \"<string>\",\n \"products\": [\n {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 4503599627370496,\n \"quantity\": 1,\n \"description\": \"<string>\",\n \"image_url\": \"<string>\",\n \"compare_price\": 4503599627370496\n }\n ]\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/checkout-links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 4503599627370496,\n \"currency\": \"BRL\",\n \"title\": \"<string>\",\n \"products\": [\n {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 4503599627370496,\n \"quantity\": 1,\n \"description\": \"<string>\",\n \"image_url\": \"<string>\",\n \"compare_price\": 4503599627370496\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pagou.ai/v2/checkout-links")
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\": 4503599627370496,\n \"currency\": \"BRL\",\n \"title\": \"<string>\",\n \"products\": [\n {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 4503599627370496,\n \"quantity\": 1,\n \"description\": \"<string>\",\n \"image_url\": \"<string>\",\n \"compare_price\": 4503599627370496\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"requestId": "0190a2b4-18a7-7de0-9a43-69b7cf261201",
"data": {
"url": "https://example.com"
}
}{
"error": "<string>",
"message": "<string>",
"status": 422
}{
"error": "<string>",
"message": "<string>",
"status": 500
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}
