Create a checkout session from a payment link (by slug)
curl --request POST \
--url http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session \
--header 'Content-Type: application/json' \
--data '
{
"full_name": "Maria Silva",
"email": "maria.silva@example.com",
"cpf_cnpj": "12345678909",
"coupon_code": "<string>"
}
'import requests
url = "http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session"
payload = {
"full_name": "Maria Silva",
"email": "maria.silva@example.com",
"cpf_cnpj": "12345678909",
"coupon_code": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
full_name: 'Maria Silva',
email: 'maria.silva@example.com',
cpf_cnpj: '12345678909',
coupon_code: '<string>'
})
};
fetch('http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "7701",
CURLOPT_URL => "http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session",
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([
'full_name' => 'Maria Silva',
'email' => 'maria.silva@example.com',
'cpf_cnpj' => '12345678909',
'coupon_code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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 := "http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session"
payload := strings.NewReader("{\n \"full_name\": \"Maria Silva\",\n \"email\": \"maria.silva@example.com\",\n \"cpf_cnpj\": \"12345678909\",\n \"coupon_code\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session")
.header("Content-Type", "application/json")
.body("{\n \"full_name\": \"Maria Silva\",\n \"email\": \"maria.silva@example.com\",\n \"cpf_cnpj\": \"12345678909\",\n \"coupon_code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"full_name\": \"Maria Silva\",\n \"email\": \"maria.silva@example.com\",\n \"cpf_cnpj\": \"12345678909\",\n \"coupon_code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "cs_live_a1b2c3...",
"type": "one_time",
"plan_id": 123,
"amount": 29900,
"currency": "BRL",
"merchant_order_id": "pl_6a1f2c3d",
"payment_method": "card",
"gateway_first_try": "<string>",
"metadata": {},
"success_url": "<string>",
"cancel_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"saved_cards": [
{}
]
}Payment Links
Create a checkout session from a payment link (by slug)
Rota pública, sem autenticação. A sessão é de uso único.
POST
/
api
/
v1
/
p
/
{companySlug}
/
{linkSlug}
/
session
Create a checkout session from a payment link (by slug)
curl --request POST \
--url http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session \
--header 'Content-Type: application/json' \
--data '
{
"full_name": "Maria Silva",
"email": "maria.silva@example.com",
"cpf_cnpj": "12345678909",
"coupon_code": "<string>"
}
'import requests
url = "http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session"
payload = {
"full_name": "Maria Silva",
"email": "maria.silva@example.com",
"cpf_cnpj": "12345678909",
"coupon_code": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
full_name: 'Maria Silva',
email: 'maria.silva@example.com',
cpf_cnpj: '12345678909',
coupon_code: '<string>'
})
};
fetch('http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "7701",
CURLOPT_URL => "http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session",
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([
'full_name' => 'Maria Silva',
'email' => 'maria.silva@example.com',
'cpf_cnpj' => '12345678909',
'coupon_code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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 := "http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session"
payload := strings.NewReader("{\n \"full_name\": \"Maria Silva\",\n \"email\": \"maria.silva@example.com\",\n \"cpf_cnpj\": \"12345678909\",\n \"coupon_code\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session")
.header("Content-Type", "application/json")
.body("{\n \"full_name\": \"Maria Silva\",\n \"email\": \"maria.silva@example.com\",\n \"cpf_cnpj\": \"12345678909\",\n \"coupon_code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:7701/api/v1/p/{companySlug}/{linkSlug}/session")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"full_name\": \"Maria Silva\",\n \"email\": \"maria.silva@example.com\",\n \"cpf_cnpj\": \"12345678909\",\n \"coupon_code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "cs_live_a1b2c3...",
"type": "one_time",
"plan_id": 123,
"amount": 29900,
"currency": "BRL",
"merchant_order_id": "pl_6a1f2c3d",
"payment_method": "card",
"gateway_first_try": "<string>",
"metadata": {},
"success_url": "<string>",
"cancel_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"saved_cards": [
{}
]
}Path Parameters
Example:
"minha-empresa"
Example:
"curso-premium"
Body
application/json
Response
Sessão de checkout criada — use o token como X-Checkout-Token
Example:
"cs_live_a1b2c3..."
Available options:
one_time, subscription Nulo em sessões de link de assinatura — o valor vem do plano.
Example:
29900
Example:
"BRL"
Gerado automaticamente (pl_…) quando a sessão nasce de um link de pagamento.
Example:
"pl_6a1f2c3d"
Available options:
card, pix Sempre vazio em links de pagamento — a página pública nunca expõe cartões salvos.