curl --request POST \
--url https://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'account: <account>' \
--data '
{
"name": "Tony Stark",
"number": "5425011234567793",
"month": 1,
"year": 2030,
"security_code": "123",
"type": "credit",
"flag": "mastercard"
}
'import requests
url = "https://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens"
payload = {
"name": "Tony Stark",
"number": "5425011234567793",
"month": 1,
"year": 2030,
"security_code": "123",
"type": "credit",
"flag": "mastercard"
}
headers = {
"account": "<account>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
account: '<account>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Tony Stark',
number: '5425011234567793',
month: 1,
year: 2030,
security_code: '123',
type: 'credit',
flag: 'mastercard'
})
};
fetch('https://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens', 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://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens",
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([
'name' => 'Tony Stark',
'number' => '5425011234567793',
'month' => 1,
'year' => 2030,
'security_code' => '123',
'type' => 'credit',
'flag' => 'mastercard'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"account: <account>"
],
]);
$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://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens"
payload := strings.NewReader("{\n \"name\": \"Tony Stark\",\n \"number\": \"5425011234567793\",\n \"month\": 1,\n \"year\": 2030,\n \"security_code\": \"123\",\n \"type\": \"credit\",\n \"flag\": \"mastercard\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("account", "<account>")
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://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens")
.header("account", "<account>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Tony Stark\",\n \"number\": \"5425011234567793\",\n \"month\": 1,\n \"year\": 2030,\n \"security_code\": \"123\",\n \"type\": \"credit\",\n \"flag\": \"mastercard\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["account"] = '<account>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Tony Stark\",\n \"number\": \"5425011234567793\",\n \"month\": 1,\n \"year\": 2030,\n \"security_code\": \"123\",\n \"type\": \"credit\",\n \"flag\": \"mastercard\"\n}"
response = http.request(request)
puts response.read_body{
"mensagem": "Cartão recebido. A tokenização foi iniciada; o resultado será enviado por webhook.",
"erro": false,
"mensagenserro": [],
"codigoretorno": 202,
"id": "00000000-0000-0000-0000-000000000000",
"data": {
"id": "9b2f5c8e-3a1d-4f7b-8c6e-2d9a1b4c5e6f",
"card_token": "9b2f5c8e-3a1d-4f7b-8c6e-2d9a1b4c5e6f",
"first_six_digits": "542501",
"last_four_digits": "7793",
"brand": "mastercard",
"holder_name": "Tony Stark",
"exp_month": 1,
"exp_year": 2030,
"type": "credit",
"status": "active",
"tokenization_status": "pending",
"created_at": "2026-05-27T10:00:00-03:00",
"updated_at": "2026-05-27T10:00:00-03:00"
}
}{
"mensagem": "Unauthenticated.",
"erro": true,
"mensagenserro": [],
"codigoretorno": 401,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}{
"mensagem": "The charge code does not match any charge",
"erro": true,
"mensagenserro": [],
"codigoretorno": 404,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}{
"message": "The given data was invalid.",
"errors": {
"client.email": [
"O campo client.email é obrigatório."
]
}
}{
"mensagem": "Um erro aconteceu.",
"erro": true,
"mensagenserro": [
"Erro interno. Tente novamente mais tarde."
],
"codigoretorno": 500,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}Salvar Cartão
Salva um cartão para o cliente e inicia sua tokenização. A resposta retorna imediatamente com tokenization_status: "pending"; o resultado da tokenização é entregue de forma assíncrona por webhook (card.token_created em caso de sucesso ou card.token_failed caso o cartão não possa ser tokenizado). Um evento card.created também é emitido ao salvar o cartão.
O número completo (PAN) e o CVV nunca são retornados — apenas os seis primeiros e os quatro últimos dígitos. Aceita o header opcional Idempotency-Key para evitar cadastros duplicados em retentativas. Requer o header account com o código da conta.
curl --request POST \
--url https://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'account: <account>' \
--data '
{
"name": "Tony Stark",
"number": "5425011234567793",
"month": 1,
"year": 2030,
"security_code": "123",
"type": "credit",
"flag": "mastercard"
}
'import requests
url = "https://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens"
payload = {
"name": "Tony Stark",
"number": "5425011234567793",
"month": 1,
"year": 2030,
"security_code": "123",
"type": "credit",
"flag": "mastercard"
}
headers = {
"account": "<account>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
account: '<account>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Tony Stark',
number: '5425011234567793',
month: 1,
year: 2030,
security_code: '123',
type: 'credit',
flag: 'mastercard'
})
};
fetch('https://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens', 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://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens",
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([
'name' => 'Tony Stark',
'number' => '5425011234567793',
'month' => 1,
'year' => 2030,
'security_code' => '123',
'type' => 'credit',
'flag' => 'mastercard'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"account: <account>"
],
]);
$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://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens"
payload := strings.NewReader("{\n \"name\": \"Tony Stark\",\n \"number\": \"5425011234567793\",\n \"month\": 1,\n \"year\": 2030,\n \"security_code\": \"123\",\n \"type\": \"credit\",\n \"flag\": \"mastercard\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("account", "<account>")
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://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens")
.header("account", "<account>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Tony Stark\",\n \"number\": \"5425011234567793\",\n \"month\": 1,\n \"year\": 2030,\n \"security_code\": \"123\",\n \"type\": \"credit\",\n \"flag\": \"mastercard\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.4seletpay.com.br/api/v1/clients/{clientCode}/cards/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["account"] = '<account>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Tony Stark\",\n \"number\": \"5425011234567793\",\n \"month\": 1,\n \"year\": 2030,\n \"security_code\": \"123\",\n \"type\": \"credit\",\n \"flag\": \"mastercard\"\n}"
response = http.request(request)
puts response.read_body{
"mensagem": "Cartão recebido. A tokenização foi iniciada; o resultado será enviado por webhook.",
"erro": false,
"mensagenserro": [],
"codigoretorno": 202,
"id": "00000000-0000-0000-0000-000000000000",
"data": {
"id": "9b2f5c8e-3a1d-4f7b-8c6e-2d9a1b4c5e6f",
"card_token": "9b2f5c8e-3a1d-4f7b-8c6e-2d9a1b4c5e6f",
"first_six_digits": "542501",
"last_four_digits": "7793",
"brand": "mastercard",
"holder_name": "Tony Stark",
"exp_month": 1,
"exp_year": 2030,
"type": "credit",
"status": "active",
"tokenization_status": "pending",
"created_at": "2026-05-27T10:00:00-03:00",
"updated_at": "2026-05-27T10:00:00-03:00"
}
}{
"mensagem": "Unauthenticated.",
"erro": true,
"mensagenserro": [],
"codigoretorno": 401,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}{
"mensagem": "The charge code does not match any charge",
"erro": true,
"mensagenserro": [],
"codigoretorno": 404,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}{
"message": "The given data was invalid.",
"errors": {
"client.email": [
"O campo client.email é obrigatório."
]
}
}{
"mensagem": "Um erro aconteceu.",
"erro": true,
"mensagenserro": [
"Erro interno. Tente novamente mais tarde."
],
"codigoretorno": 500,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}account com o código da conta. O cartão é salvo para o cliente informado no clientCode e a tokenização é iniciada automaticamente.tokenization_status: "pending". O resultado da tokenização é entregue de forma assíncrona por webhook — você não precisa fazer polling. Envie o header opcional Idempotency-Key para evitar cadastros duplicados em caso de retentativa.Ciclo de tokenização
Acompanhe a disponibilidade do cartão pelos eventos de webhook:| Evento | Quando é disparado |
|---|---|
card.created | Assim que o cartão é salvo. |
card.token_created | Quando o cartão foi tokenizado e está pronto para cobranças. |
card.token_failed | Quando não foi possível tokenizar o cartão. |
tokenization_status estiver pending, o cartão ainda está sendo preparado. Aguarde o card.token_created antes de usá-lo em uma cobrança.
Usando o cartão salvo
O campocard_token (presente na resposta e no evento card.token_created) é o identificador que você envia em payment.card.card_token ao criar uma cobrança ou pedido com o cartão salvo.
card_token, você também precisa informar o billing address (client.address) na requisição.first_six_digits e last_four_digits.Authorizations
Token JWT obtido via POST /v1/login. Envie no header Authorization: Bearer <token>.
Headers
Código da conta à qual a operação se aplica
"acc_abc123xyz"
Chave de idempotência para evitar cadastros duplicados (máx. 128 caracteres)
"a1b2c3d4-idem-key"
Path Parameters
Código único do cliente dono do cartão
"cli_abc123"
Body
Nome do portador impresso no cartão
255"Tony Stark"
Número do cartão (13–19 dígitos, validado por Luhn)
"5425011234567793"
Mês de validade
1 <= x <= 121
Ano de validade (2 ou 4 dígitos; deve estar no futuro)
2030
Código de segurança (CVV, 3 ou 4 dígitos)
"123"
Tipo do cartão
credit, debit "credit"
Bandeira do cartão (opcional)
visa, mastercard, elo, amex "mastercard"
Response
Cartão recebido; tokenização iniciada
