Guardar cartão no Cofre
curl --request POST \
--url https://api.uvvipay.com.br/v1/vault/tokenize \
--header 'Content-Type: application/json' \
--header 'client-id: <api-key>' \
--header 'client-secret: <api-key>' \
--data '
{
"card": {
"number": "************1111",
"holderName": "JOAO DA SILVA",
"securityCode": "***",
"expirationMonth": 12,
"expirationYear": 2029
},
"customer": {
"name": "João da Silva",
"email": "joao@exemplo.com",
"documentNumber": "12345678901",
"documentType": "cpf",
"externalCustomerId": "customer-ext-00000000001",
"phone": "11987654321"
}
}
'import requests
url = "https://api.uvvipay.com.br/v1/vault/tokenize"
payload = {
"card": {
"number": "************1111",
"holderName": "JOAO DA SILVA",
"securityCode": "***",
"expirationMonth": 12,
"expirationYear": 2029
},
"customer": {
"name": "João da Silva",
"email": "joao@exemplo.com",
"documentNumber": "12345678901",
"documentType": "cpf",
"externalCustomerId": "customer-ext-00000000001",
"phone": "11987654321"
}
}
headers = {
"client-id": "<api-key>",
"client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'client-id': '<api-key>',
'client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
card: {
number: '************1111',
holderName: 'JOAO DA SILVA',
securityCode: '***',
expirationMonth: 12,
expirationYear: 2029
},
customer: {
name: 'João da Silva',
email: 'joao@exemplo.com',
documentNumber: '12345678901',
documentType: 'cpf',
externalCustomerId: 'customer-ext-00000000001',
phone: '11987654321'
}
})
};
fetch('https://api.uvvipay.com.br/v1/vault/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://api.uvvipay.com.br/v1/vault/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([
'card' => [
'number' => '************1111',
'holderName' => 'JOAO DA SILVA',
'securityCode' => '***',
'expirationMonth' => 12,
'expirationYear' => 2029
],
'customer' => [
'name' => 'João da Silva',
'email' => 'joao@exemplo.com',
'documentNumber' => '12345678901',
'documentType' => 'cpf',
'externalCustomerId' => 'customer-ext-00000000001',
'phone' => '11987654321'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"client-id: <api-key>",
"client-secret: <api-key>"
],
]);
$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.uvvipay.com.br/v1/vault/tokenize"
payload := strings.NewReader("{\n \"card\": {\n \"number\": \"************1111\",\n \"holderName\": \"JOAO DA SILVA\",\n \"securityCode\": \"***\",\n \"expirationMonth\": 12,\n \"expirationYear\": 2029\n },\n \"customer\": {\n \"name\": \"João da Silva\",\n \"email\": \"joao@exemplo.com\",\n \"documentNumber\": \"12345678901\",\n \"documentType\": \"cpf\",\n \"externalCustomerId\": \"customer-ext-00000000001\",\n \"phone\": \"11987654321\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client-id", "<api-key>")
req.Header.Add("client-secret", "<api-key>")
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.uvvipay.com.br/v1/vault/tokenize")
.header("client-id", "<api-key>")
.header("client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"card\": {\n \"number\": \"************1111\",\n \"holderName\": \"JOAO DA SILVA\",\n \"securityCode\": \"***\",\n \"expirationMonth\": 12,\n \"expirationYear\": 2029\n },\n \"customer\": {\n \"name\": \"João da Silva\",\n \"email\": \"joao@exemplo.com\",\n \"documentNumber\": \"12345678901\",\n \"documentType\": \"cpf\",\n \"externalCustomerId\": \"customer-ext-00000000001\",\n \"phone\": \"11987654321\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uvvipay.com.br/v1/vault/tokenize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client-id"] = '<api-key>'
request["client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"card\": {\n \"number\": \"************1111\",\n \"holderName\": \"JOAO DA SILVA\",\n \"securityCode\": \"***\",\n \"expirationMonth\": 12,\n \"expirationYear\": 2029\n },\n \"customer\": {\n \"name\": \"João da Silva\",\n \"email\": \"joao@exemplo.com\",\n \"documentNumber\": \"12345678901\",\n \"documentType\": \"cpf\",\n \"externalCustomerId\": \"customer-ext-00000000001\",\n \"phone\": \"11987654321\"\n }\n}"
response = http.request(request)
puts response.read_body{
"cardTokenId": "550e8400-e29b-41d4-a716-446655440000"
}Cofre
Guardar cartão no Cofre
Guarda um cartão de crédito no Cofre para o customer informado. Requer o produto tokenization habilitado. Se já existir um token ativo para o mesmo customer e cartão, retorna o cardTokenId existente (HTTP 201).
POST
/
v1
/
vault
/
tokenize
Guardar cartão no Cofre
curl --request POST \
--url https://api.uvvipay.com.br/v1/vault/tokenize \
--header 'Content-Type: application/json' \
--header 'client-id: <api-key>' \
--header 'client-secret: <api-key>' \
--data '
{
"card": {
"number": "************1111",
"holderName": "JOAO DA SILVA",
"securityCode": "***",
"expirationMonth": 12,
"expirationYear": 2029
},
"customer": {
"name": "João da Silva",
"email": "joao@exemplo.com",
"documentNumber": "12345678901",
"documentType": "cpf",
"externalCustomerId": "customer-ext-00000000001",
"phone": "11987654321"
}
}
'import requests
url = "https://api.uvvipay.com.br/v1/vault/tokenize"
payload = {
"card": {
"number": "************1111",
"holderName": "JOAO DA SILVA",
"securityCode": "***",
"expirationMonth": 12,
"expirationYear": 2029
},
"customer": {
"name": "João da Silva",
"email": "joao@exemplo.com",
"documentNumber": "12345678901",
"documentType": "cpf",
"externalCustomerId": "customer-ext-00000000001",
"phone": "11987654321"
}
}
headers = {
"client-id": "<api-key>",
"client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'client-id': '<api-key>',
'client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
card: {
number: '************1111',
holderName: 'JOAO DA SILVA',
securityCode: '***',
expirationMonth: 12,
expirationYear: 2029
},
customer: {
name: 'João da Silva',
email: 'joao@exemplo.com',
documentNumber: '12345678901',
documentType: 'cpf',
externalCustomerId: 'customer-ext-00000000001',
phone: '11987654321'
}
})
};
fetch('https://api.uvvipay.com.br/v1/vault/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://api.uvvipay.com.br/v1/vault/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([
'card' => [
'number' => '************1111',
'holderName' => 'JOAO DA SILVA',
'securityCode' => '***',
'expirationMonth' => 12,
'expirationYear' => 2029
],
'customer' => [
'name' => 'João da Silva',
'email' => 'joao@exemplo.com',
'documentNumber' => '12345678901',
'documentType' => 'cpf',
'externalCustomerId' => 'customer-ext-00000000001',
'phone' => '11987654321'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"client-id: <api-key>",
"client-secret: <api-key>"
],
]);
$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.uvvipay.com.br/v1/vault/tokenize"
payload := strings.NewReader("{\n \"card\": {\n \"number\": \"************1111\",\n \"holderName\": \"JOAO DA SILVA\",\n \"securityCode\": \"***\",\n \"expirationMonth\": 12,\n \"expirationYear\": 2029\n },\n \"customer\": {\n \"name\": \"João da Silva\",\n \"email\": \"joao@exemplo.com\",\n \"documentNumber\": \"12345678901\",\n \"documentType\": \"cpf\",\n \"externalCustomerId\": \"customer-ext-00000000001\",\n \"phone\": \"11987654321\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client-id", "<api-key>")
req.Header.Add("client-secret", "<api-key>")
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.uvvipay.com.br/v1/vault/tokenize")
.header("client-id", "<api-key>")
.header("client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"card\": {\n \"number\": \"************1111\",\n \"holderName\": \"JOAO DA SILVA\",\n \"securityCode\": \"***\",\n \"expirationMonth\": 12,\n \"expirationYear\": 2029\n },\n \"customer\": {\n \"name\": \"João da Silva\",\n \"email\": \"joao@exemplo.com\",\n \"documentNumber\": \"12345678901\",\n \"documentType\": \"cpf\",\n \"externalCustomerId\": \"customer-ext-00000000001\",\n \"phone\": \"11987654321\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uvvipay.com.br/v1/vault/tokenize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client-id"] = '<api-key>'
request["client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"card\": {\n \"number\": \"************1111\",\n \"holderName\": \"JOAO DA SILVA\",\n \"securityCode\": \"***\",\n \"expirationMonth\": 12,\n \"expirationYear\": 2029\n },\n \"customer\": {\n \"name\": \"João da Silva\",\n \"email\": \"joao@exemplo.com\",\n \"documentNumber\": \"12345678901\",\n \"documentType\": \"cpf\",\n \"externalCustomerId\": \"customer-ext-00000000001\",\n \"phone\": \"11987654321\"\n }\n}"
response = http.request(request)
puts response.read_body{
"cardTokenId": "550e8400-e29b-41d4-a716-446655440000"
}Headers
ID público da credencial do merchant
Secret da credencial do merchant
Body
application/json
Response
Cartão guardado no Cofre com sucesso
Identificador do token de cartão na UvviPay
Example:
"550e8400-e29b-41d4-a716-446655440000"
⌘I

