curl --request POST \
--url https://api-global.fastpaybrasil.com/v1/cards \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"customerId": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"number": "4111111111111111",
"holderName": "JOHN DOE",
"expirationMonth": "12",
"expirationYear": "2028",
"cvv": "123",
"alias": "My Visa Card",
"validateCard": true
}
'import requests
url = "https://api-global.fastpaybrasil.com/v1/cards"
payload = {
"customerId": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"number": "4111111111111111",
"holderName": "JOHN DOE",
"expirationMonth": "12",
"expirationYear": "2028",
"cvv": "123",
"alias": "My Visa Card",
"validateCard": True
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerId: '2RhQg9M7ZCg3X3nMb9W1kX8Q',
number: '4111111111111111',
holderName: 'JOHN DOE',
expirationMonth: '12',
expirationYear: '2028',
cvv: '123',
alias: 'My Visa Card',
validateCard: true
})
};
fetch('https://api-global.fastpaybrasil.com/v1/cards', 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-global.fastpaybrasil.com/v1/cards",
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' => '2RhQg9M7ZCg3X3nMb9W1kX8Q',
'number' => '4111111111111111',
'holderName' => 'JOHN DOE',
'expirationMonth' => '12',
'expirationYear' => '2028',
'cvv' => '123',
'alias' => 'My Visa Card',
'validateCard' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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-global.fastpaybrasil.com/v1/cards"
payload := strings.NewReader("{\n \"customerId\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"number\": \"4111111111111111\",\n \"holderName\": \"JOHN DOE\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2028\",\n \"cvv\": \"123\",\n \"alias\": \"My Visa Card\",\n \"validateCard\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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-global.fastpaybrasil.com/v1/cards")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"number\": \"4111111111111111\",\n \"holderName\": \"JOHN DOE\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2028\",\n \"cvv\": \"123\",\n \"alias\": \"My Visa Card\",\n \"validateCard\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-global.fastpaybrasil.com/v1/cards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerId\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"number\": \"4111111111111111\",\n \"holderName\": \"JOHN DOE\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2028\",\n \"cvv\": \"123\",\n \"alias\": \"My Visa Card\",\n \"validateCard\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"token": "tok_abc123xyz",
"maskedNumber": "****1111",
"status": "pending_validation",
"pendingActivation": true,
"activation": {
"required": true,
"message": "Verifique o valor da transacao de teste na fatura do cartao e use o endpoint /cards/:id/activate"
}
}{
"statusCode": 400,
"message": "Failed to register card"
}{
"statusCode": 401,
"message": "Unauthorized"
}Register a card
Registers a new credit card for a customer. The card is stored securely in the token vault and can be used for recurring charges.
By default (validateCard=true), a small test transaction (up to R$ 2.00)
is made to validate the card. The customer must verify this amount on their
statement and use the /cards/{id}/activate endpoint to activate the card.
curl --request POST \
--url https://api-global.fastpaybrasil.com/v1/cards \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"customerId": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"number": "4111111111111111",
"holderName": "JOHN DOE",
"expirationMonth": "12",
"expirationYear": "2028",
"cvv": "123",
"alias": "My Visa Card",
"validateCard": true
}
'import requests
url = "https://api-global.fastpaybrasil.com/v1/cards"
payload = {
"customerId": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"number": "4111111111111111",
"holderName": "JOHN DOE",
"expirationMonth": "12",
"expirationYear": "2028",
"cvv": "123",
"alias": "My Visa Card",
"validateCard": True
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerId: '2RhQg9M7ZCg3X3nMb9W1kX8Q',
number: '4111111111111111',
holderName: 'JOHN DOE',
expirationMonth: '12',
expirationYear: '2028',
cvv: '123',
alias: 'My Visa Card',
validateCard: true
})
};
fetch('https://api-global.fastpaybrasil.com/v1/cards', 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-global.fastpaybrasil.com/v1/cards",
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' => '2RhQg9M7ZCg3X3nMb9W1kX8Q',
'number' => '4111111111111111',
'holderName' => 'JOHN DOE',
'expirationMonth' => '12',
'expirationYear' => '2028',
'cvv' => '123',
'alias' => 'My Visa Card',
'validateCard' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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-global.fastpaybrasil.com/v1/cards"
payload := strings.NewReader("{\n \"customerId\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"number\": \"4111111111111111\",\n \"holderName\": \"JOHN DOE\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2028\",\n \"cvv\": \"123\",\n \"alias\": \"My Visa Card\",\n \"validateCard\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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-global.fastpaybrasil.com/v1/cards")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"number\": \"4111111111111111\",\n \"holderName\": \"JOHN DOE\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2028\",\n \"cvv\": \"123\",\n \"alias\": \"My Visa Card\",\n \"validateCard\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-global.fastpaybrasil.com/v1/cards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerId\": \"2RhQg9M7ZCg3X3nMb9W1kX8Q\",\n \"number\": \"4111111111111111\",\n \"holderName\": \"JOHN DOE\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2028\",\n \"cvv\": \"123\",\n \"alias\": \"My Visa Card\",\n \"validateCard\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "2RhQg9M7ZCg3X3nMb9W1kX8Q",
"token": "tok_abc123xyz",
"maskedNumber": "****1111",
"status": "pending_validation",
"pendingActivation": true,
"activation": {
"required": true,
"message": "Verifique o valor da transacao de teste na fatura do cartao e use o endpoint /cards/:id/activate"
}
}{
"statusCode": 400,
"message": "Failed to register card"
}{
"statusCode": 401,
"message": "Unauthorized"
}Authorizations
HTTP Basic authentication. Use your secret key as the username and an empty string as password. The API key should be base64 encoded in the format 'username:' when sending the Authorization header.
Body
Customer ID who owns the card
"2RhQg9M7ZCg3X3nMb9W1kX8Q"
Card number
"4111111111111111"
Name printed on card
"JOHN DOE"
Expiration month (01-12)
2"12"
Expiration year (YYYY)
4"2028"
Security code
3"123"
Optional alias for the card
"My Visa Card"
Whether to validate the card with a test transaction. When true, a small amount (up to R$ 2.00) is charged and must be confirmed via the /cards/{id}/activate endpoint.
true
Response
Card registered successfully
Card token ID
"2RhQg9M7ZCg3X3nMb9W1kX8Q"
Card token for future reference
"tok_abc123xyz"
Masked card number (last 4 digits)
"****1111"
Card status
pending_validation, active "pending_validation"
Whether card requires activation
true
Activation instructions (only when validateCard=true)
Show child attributes
Show child attributes