Tokenizar cartão
curl --request POST \
--url https://api.nasten.net/v1/card-token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"number": "4111111111111111",
"holderName": "CLIENTE EXEMPLO",
"expirationMonth": "12",
"expirationYear": "2030",
"cvv": "123"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
number: '4111111111111111',
holderName: 'CLIENTE EXEMPLO',
expirationMonth: '12',
expirationYear: '2030',
cvv: '123'
})
};
fetch('https://api.nasten.net/v1/card-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nasten.net/v1/card-token"
payload = {
"number": "4111111111111111",
"holderName": "CLIENTE EXEMPLO",
"expirationMonth": "12",
"expirationYear": "2030",
"cvv": "123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nasten.net/v1/card-token",
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([
'number' => '4111111111111111',
'holderName' => 'CLIENTE EXEMPLO',
'expirationMonth' => '12',
'expirationYear' => '2030',
'cvv' => '123'
]),
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.nasten.net/v1/card-token"
payload := strings.NewReader("{\n \"number\": \"4111111111111111\",\n \"holderName\": \"CLIENTE EXEMPLO\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2030\",\n \"cvv\": \"123\"\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.nasten.net/v1/card-token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"4111111111111111\",\n \"holderName\": \"CLIENTE EXEMPLO\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2030\",\n \"cvv\": \"123\"\n}")
.asString();{
"success": true,
"token": "ct_9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1f0e9d8c7b6a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"errors": [
{
"path": "customer.document",
"message": "Documento inválido"
}
]
}{
"success": false,
"message": "Token inválido ou expirado",
"code": "NST-401-rcp9"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"error": "Too Many Requests",
"retryAfterMs": 42000,
"limit": 1800,
"window": "1 minute"
}{
"success": false,
"message": "Internal server error",
"code": "NST-500-9e2b"
}Cartão
Tokenizar cartão
Guarda os dados do cartão e devolve um token (prefixo ct_) para usar em POST /v1/card.
O token vale 15 minutos, só serve para a empresa que o gerou e não é de uso único.
POST
/
v1
/
card-token
Tokenizar cartão
curl --request POST \
--url https://api.nasten.net/v1/card-token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"number": "4111111111111111",
"holderName": "CLIENTE EXEMPLO",
"expirationMonth": "12",
"expirationYear": "2030",
"cvv": "123"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
number: '4111111111111111',
holderName: 'CLIENTE EXEMPLO',
expirationMonth: '12',
expirationYear: '2030',
cvv: '123'
})
};
fetch('https://api.nasten.net/v1/card-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nasten.net/v1/card-token"
payload = {
"number": "4111111111111111",
"holderName": "CLIENTE EXEMPLO",
"expirationMonth": "12",
"expirationYear": "2030",
"cvv": "123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nasten.net/v1/card-token",
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([
'number' => '4111111111111111',
'holderName' => 'CLIENTE EXEMPLO',
'expirationMonth' => '12',
'expirationYear' => '2030',
'cvv' => '123'
]),
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.nasten.net/v1/card-token"
payload := strings.NewReader("{\n \"number\": \"4111111111111111\",\n \"holderName\": \"CLIENTE EXEMPLO\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2030\",\n \"cvv\": \"123\"\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.nasten.net/v1/card-token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"4111111111111111\",\n \"holderName\": \"CLIENTE EXEMPLO\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2030\",\n \"cvv\": \"123\"\n}")
.asString();{
"success": true,
"token": "ct_9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1f0e9d8c7b6a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"errors": [
{
"path": "customer.document",
"message": "Documento inválido"
}
]
}{
"success": false,
"message": "Token inválido ou expirado",
"code": "NST-401-rcp9"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"error": "Too Many Requests",
"retryAfterMs": 42000,
"limit": 1800,
"window": "1 minute"
}{
"success": false,
"message": "Internal server error",
"code": "NST-500-9e2b"
}Body
application/json

