Criar um link do portal do cliente
curl --request POST \
--url https://api.abacatepay.com/v2/customer-portal/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customerId": "cust_abc123xyz",
"checkoutId": "bill_abc123xyz"
}
'import requests
url = "https://api.abacatepay.com/v2/customer-portal/create"
payload = {
"customerId": "cust_abc123xyz",
"checkoutId": "bill_abc123xyz"
}
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({customerId: 'cust_abc123xyz', checkoutId: 'bill_abc123xyz'})
};
fetch('https://api.abacatepay.com/v2/customer-portal/create', 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.abacatepay.com/v2/customer-portal/create",
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([
'customerId' => 'cust_abc123xyz',
'checkoutId' => 'bill_abc123xyz'
]),
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.abacatepay.com/v2/customer-portal/create"
payload := strings.NewReader("{\n \"customerId\": \"cust_abc123xyz\",\n \"checkoutId\": \"bill_abc123xyz\"\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.abacatepay.com/v2/customer-portal/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"cust_abc123xyz\",\n \"checkoutId\": \"bill_abc123xyz\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.abacatepay.com/v2/customer-portal/create")
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 \"customerId\": \"cust_abc123xyz\",\n \"checkoutId\": \"bill_abc123xyz\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "cpl_abc123xyz",
"url": "https://portal.abacatepay.com/k3J9xQ2mP7vL1nR8sT4wY6zA0bC5dE2f",
"customerId": "cust_abc123xyz",
"checkoutId": "bill_abc123xyz",
"devMode": false,
"createdAt": "2026-10-19T12:00:00.000Z"
},
"error": null,
"success": true
}{
"error": "Token de autenticação inválido ou ausente."
}Portal do cliente
Criar um link do portal
Gera o link do portal do cliente para um cliente e um checkout que ele pagou. Chamar de novo com o mesmo customerId e checkoutId devolve o mesmo link.
O cliente entra no portal com um código de 6 dígitos enviado ao e-mail do cadastro e consegue ver os pagamentos, pedir reembolso, cancelar a assinatura e trocar o cartão.
POST
/
customer-portal
/
create
Criar um link do portal do cliente
curl --request POST \
--url https://api.abacatepay.com/v2/customer-portal/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customerId": "cust_abc123xyz",
"checkoutId": "bill_abc123xyz"
}
'import requests
url = "https://api.abacatepay.com/v2/customer-portal/create"
payload = {
"customerId": "cust_abc123xyz",
"checkoutId": "bill_abc123xyz"
}
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({customerId: 'cust_abc123xyz', checkoutId: 'bill_abc123xyz'})
};
fetch('https://api.abacatepay.com/v2/customer-portal/create', 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.abacatepay.com/v2/customer-portal/create",
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([
'customerId' => 'cust_abc123xyz',
'checkoutId' => 'bill_abc123xyz'
]),
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.abacatepay.com/v2/customer-portal/create"
payload := strings.NewReader("{\n \"customerId\": \"cust_abc123xyz\",\n \"checkoutId\": \"bill_abc123xyz\"\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.abacatepay.com/v2/customer-portal/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"cust_abc123xyz\",\n \"checkoutId\": \"bill_abc123xyz\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.abacatepay.com/v2/customer-portal/create")
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 \"customerId\": \"cust_abc123xyz\",\n \"checkoutId\": \"bill_abc123xyz\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "cpl_abc123xyz",
"url": "https://portal.abacatepay.com/k3J9xQ2mP7vL1nR8sT4wY6zA0bC5dE2f",
"customerId": "cust_abc123xyz",
"checkoutId": "bill_abc123xyz",
"devMode": false,
"createdAt": "2026-10-19T12:00:00.000Z"
},
"error": null,
"success": true
}{
"error": "Token de autenticação inválido ou ausente."
}Gera o link do portal do cliente para um cliente e um checkout que ele pagou. Veja o que o cliente consegue fazer no portal em Referência.
Exemplo:
Requer uma destas permissões:
CHECKOUT:CREATE, SUBSCRIPTION:CREATE ou CUSTOMER:CREATE.{
"customerId": "cust_abc123xyz",
"checkoutId": "bill_abc123xyz"
}
Chamar de novo com o mesmo
customerId e checkoutId devolve o mesmo link. Não precisa guardar a url.Quando o link não sai
| Erro | Motivo |
|---|---|
Checkout not found | O checkoutId não existe na sua loja (ou é de outro modo, dev ou produção). |
Customer not found | O customerId não existe ou foi removido. |
Customer has no email to receive the access code | O cliente não tem e-mail; o código de acesso vai por e-mail. |
Customer has no payment for this checkout | O cliente ainda não pagou esse checkout. Em assinatura, ainda não tem assinatura criada nele. |
Authorizations
Todas as requisições devem incluir sua chave de API no header Authorization usando o formato Bearer <abacatepay-api-key>. Sem esse header a requisição será rejeitada.
Saiba mais sobre como criar e usar chaves de API na documentação de autenticação.
Body
application/json
Was this page helpful?