Tokenize a PAN
curl --request POST \
--url https://services.sandbox.pagosapi.com/toucan/tokens/tokenize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-merchant-id: <x-merchant-id>' \
--data '
{
"accountNumber": "1234123412341234",
"expirationDate": {
"year": "<string>",
"month": "<string>"
},
"cvv2": "<string>",
"accountHolder": {
"name": "<string>",
"address": {
"line1": "<string>",
"line2": "<string>",
"line3": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postalCode": "<string>"
}
},
"metadata": "<string>"
}
'import requests
url = "https://services.sandbox.pagosapi.com/toucan/tokens/tokenize"
payload = {
"accountNumber": "1234123412341234",
"expirationDate": {
"year": "<string>",
"month": "<string>"
},
"cvv2": "<string>",
"accountHolder": {
"name": "<string>",
"address": {
"line1": "<string>",
"line2": "<string>",
"line3": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postalCode": "<string>"
}
},
"metadata": "<string>"
}
headers = {
"x-merchant-id": "<x-merchant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-merchant-id': '<x-merchant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountNumber: '1234123412341234',
expirationDate: {year: '<string>', month: '<string>'},
cvv2: '<string>',
accountHolder: {
name: '<string>',
address: {
line1: '<string>',
line2: '<string>',
line3: '<string>',
city: '<string>',
state: '<string>',
country: '<string>',
postalCode: '<string>'
}
},
metadata: '<string>'
})
};
fetch('https://services.sandbox.pagosapi.com/toucan/tokens/tokenize', 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://services.sandbox.pagosapi.com/toucan/tokens/tokenize",
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([
'accountNumber' => '1234123412341234',
'expirationDate' => [
'year' => '<string>',
'month' => '<string>'
],
'cvv2' => '<string>',
'accountHolder' => [
'name' => '<string>',
'address' => [
'line1' => '<string>',
'line2' => '<string>',
'line3' => '<string>',
'city' => '<string>',
'state' => '<string>',
'country' => '<string>',
'postalCode' => '<string>'
]
],
'metadata' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-merchant-id: <x-merchant-id>"
],
]);
$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://services.sandbox.pagosapi.com/toucan/tokens/tokenize"
payload := strings.NewReader("{\n \"accountNumber\": \"1234123412341234\",\n \"expirationDate\": {\n \"year\": \"<string>\",\n \"month\": \"<string>\"\n },\n \"cvv2\": \"<string>\",\n \"accountHolder\": {\n \"name\": \"<string>\",\n \"address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"line3\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\",\n \"postalCode\": \"<string>\"\n }\n },\n \"metadata\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-merchant-id", "<x-merchant-id>")
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://services.sandbox.pagosapi.com/toucan/tokens/tokenize")
.header("x-merchant-id", "<x-merchant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountNumber\": \"1234123412341234\",\n \"expirationDate\": {\n \"year\": \"<string>\",\n \"month\": \"<string>\"\n },\n \"cvv2\": \"<string>\",\n \"accountHolder\": {\n \"name\": \"<string>\",\n \"address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"line3\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\",\n \"postalCode\": \"<string>\"\n }\n },\n \"metadata\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.sandbox.pagosapi.com/toucan/tokens/tokenize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-merchant-id"] = '<x-merchant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountNumber\": \"1234123412341234\",\n \"expirationDate\": {\n \"year\": \"<string>\",\n \"month\": \"<string>\"\n },\n \"cvv2\": \"<string>\",\n \"accountHolder\": {\n \"name\": \"<string>\",\n \"address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"line3\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\",\n \"postalCode\": \"<string>\"\n }\n },\n \"metadata\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"cardNetworkName": "<string>",
"token": "<string>",
"expirationDate": {
"year": "<string>",
"month": "<string>"
},
"tokenRefId": "<string>",
"tokenUniqueReference": "<string>",
"panLast4": "<string>",
"metadata": "<string>",
"par": "<string>"
}{
"code": 123,
"requestId": "<string>",
"errorDetails": {
"reason": "<string>",
"message": "<string>",
"details": [
{
"location": "<string>",
"message": "<string>"
}
]
}
}{
"code": 123,
"requestId": "<string>",
"errorDetails": {
"reason": "<string>",
"message": "<string>",
"details": [
{
"location": "<string>",
"message": "<string>"
}
]
}
}{
"code": 123,
"requestId": "<string>",
"errorDetails": {
"reason": "<string>",
"message": "<string>",
"details": [
{
"location": "<string>",
"message": "<string>"
}
]
}
}{
"code": 123,
"requestId": "<string>",
"errorDetails": {
"reason": "<string>",
"message": "<string>",
"details": [
{
"location": "<string>",
"message": "<string>"
}
]
}
}Network Tokenization
Tokenize a PAN
POST
/
toucan
/
tokens
/
tokenize
Tokenize a PAN
curl --request POST \
--url https://services.sandbox.pagosapi.com/toucan/tokens/tokenize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-merchant-id: <x-merchant-id>' \
--data '
{
"accountNumber": "1234123412341234",
"expirationDate": {
"year": "<string>",
"month": "<string>"
},
"cvv2": "<string>",
"accountHolder": {
"name": "<string>",
"address": {
"line1": "<string>",
"line2": "<string>",
"line3": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postalCode": "<string>"
}
},
"metadata": "<string>"
}
'import requests
url = "https://services.sandbox.pagosapi.com/toucan/tokens/tokenize"
payload = {
"accountNumber": "1234123412341234",
"expirationDate": {
"year": "<string>",
"month": "<string>"
},
"cvv2": "<string>",
"accountHolder": {
"name": "<string>",
"address": {
"line1": "<string>",
"line2": "<string>",
"line3": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postalCode": "<string>"
}
},
"metadata": "<string>"
}
headers = {
"x-merchant-id": "<x-merchant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-merchant-id': '<x-merchant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountNumber: '1234123412341234',
expirationDate: {year: '<string>', month: '<string>'},
cvv2: '<string>',
accountHolder: {
name: '<string>',
address: {
line1: '<string>',
line2: '<string>',
line3: '<string>',
city: '<string>',
state: '<string>',
country: '<string>',
postalCode: '<string>'
}
},
metadata: '<string>'
})
};
fetch('https://services.sandbox.pagosapi.com/toucan/tokens/tokenize', 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://services.sandbox.pagosapi.com/toucan/tokens/tokenize",
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([
'accountNumber' => '1234123412341234',
'expirationDate' => [
'year' => '<string>',
'month' => '<string>'
],
'cvv2' => '<string>',
'accountHolder' => [
'name' => '<string>',
'address' => [
'line1' => '<string>',
'line2' => '<string>',
'line3' => '<string>',
'city' => '<string>',
'state' => '<string>',
'country' => '<string>',
'postalCode' => '<string>'
]
],
'metadata' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-merchant-id: <x-merchant-id>"
],
]);
$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://services.sandbox.pagosapi.com/toucan/tokens/tokenize"
payload := strings.NewReader("{\n \"accountNumber\": \"1234123412341234\",\n \"expirationDate\": {\n \"year\": \"<string>\",\n \"month\": \"<string>\"\n },\n \"cvv2\": \"<string>\",\n \"accountHolder\": {\n \"name\": \"<string>\",\n \"address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"line3\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\",\n \"postalCode\": \"<string>\"\n }\n },\n \"metadata\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-merchant-id", "<x-merchant-id>")
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://services.sandbox.pagosapi.com/toucan/tokens/tokenize")
.header("x-merchant-id", "<x-merchant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountNumber\": \"1234123412341234\",\n \"expirationDate\": {\n \"year\": \"<string>\",\n \"month\": \"<string>\"\n },\n \"cvv2\": \"<string>\",\n \"accountHolder\": {\n \"name\": \"<string>\",\n \"address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"line3\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\",\n \"postalCode\": \"<string>\"\n }\n },\n \"metadata\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.sandbox.pagosapi.com/toucan/tokens/tokenize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-merchant-id"] = '<x-merchant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountNumber\": \"1234123412341234\",\n \"expirationDate\": {\n \"year\": \"<string>\",\n \"month\": \"<string>\"\n },\n \"cvv2\": \"<string>\",\n \"accountHolder\": {\n \"name\": \"<string>\",\n \"address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"line3\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\",\n \"postalCode\": \"<string>\"\n }\n },\n \"metadata\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"cardNetworkName": "<string>",
"token": "<string>",
"expirationDate": {
"year": "<string>",
"month": "<string>"
},
"tokenRefId": "<string>",
"tokenUniqueReference": "<string>",
"panLast4": "<string>",
"metadata": "<string>",
"par": "<string>"
}{
"code": 123,
"requestId": "<string>",
"errorDetails": {
"reason": "<string>",
"message": "<string>",
"details": [
{
"location": "<string>",
"message": "<string>"
}
]
}
}{
"code": 123,
"requestId": "<string>",
"errorDetails": {
"reason": "<string>",
"message": "<string>",
"details": [
{
"location": "<string>",
"message": "<string>"
}
]
}
}{
"code": 123,
"requestId": "<string>",
"errorDetails": {
"reason": "<string>",
"message": "<string>",
"details": [
{
"location": "<string>",
"message": "<string>"
}
]
}
}{
"code": 123,
"requestId": "<string>",
"errorDetails": {
"reason": "<string>",
"message": "<string>",
"details": [
{
"location": "<string>",
"message": "<string>"
}
]
}
}Authorizations
Format is: Bearer <api_key>, where <api_key> is your Pagos API key
Headers
Merchant identifier for requests.
Body
application/json
⌘I

