Transactions
Tokenize credit card
Test-mode helper that validates raw card details and returns a payment-method token for the test credit card gateway. The card is checked locally (number, expiry and cardholder name) and is never sent to a processor; the response always has test: true, and the token stays usable for one hour. Invalid card details return 400 with the failing fields. No authentication is required.
POST
/
api
/
v202506
/
payments
/
tokenize_card
Tokenize credit card
curl --request POST \
--url https://api.fluid.app/api/v202506/payments/tokenize_card \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credit_card": {
"first_name": "Jim",
"last_name": "Halpert",
"number": "4111111111111111",
"verification_value": "123",
"month": "9",
"year": "2029",
"email": "jim.halpert@dundermifflin.com"
}
}
'import requests
url = "https://api.fluid.app/api/v202506/payments/tokenize_card"
payload = { "credit_card": {
"first_name": "Jim",
"last_name": "Halpert",
"number": "4111111111111111",
"verification_value": "123",
"month": "9",
"year": "2029",
"email": "jim.halpert@dundermifflin.com"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credit_card: {
first_name: 'Jim',
last_name: 'Halpert',
number: '4111111111111111',
verification_value: '123',
month: '9',
year: '2029',
email: 'jim.halpert@dundermifflin.com'
}
})
};
fetch('https://api.fluid.app/api/v202506/payments/tokenize_card', 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.fluid.app/api/v202506/payments/tokenize_card",
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([
'credit_card' => [
'first_name' => 'Jim',
'last_name' => 'Halpert',
'number' => '4111111111111111',
'verification_value' => '123',
'month' => '9',
'year' => '2029',
'email' => 'jim.halpert@dundermifflin.com'
]
]),
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.fluid.app/api/v202506/payments/tokenize_card"
payload := strings.NewReader("{\n \"credit_card\": {\n \"first_name\": \"Jim\",\n \"last_name\": \"Halpert\",\n \"number\": \"4111111111111111\",\n \"verification_value\": \"123\",\n \"month\": \"9\",\n \"year\": \"2029\",\n \"email\": \"jim.halpert@dundermifflin.com\"\n }\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.fluid.app/api/v202506/payments/tokenize_card")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credit_card\": {\n \"first_name\": \"Jim\",\n \"last_name\": \"Halpert\",\n \"number\": \"4111111111111111\",\n \"verification_value\": \"123\",\n \"month\": \"9\",\n \"year\": \"2029\",\n \"email\": \"jim.halpert@dundermifflin.com\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/v202506/payments/tokenize_card")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credit_card\": {\n \"first_name\": \"Jim\",\n \"last_name\": \"Halpert\",\n \"number\": \"4111111111111111\",\n \"verification_value\": \"123\",\n \"month\": \"9\",\n \"year\": \"2029\",\n \"email\": \"jim.halpert@dundermifflin.com\"\n }\n}"
response = http.request(request)
puts response.read_body{
"transaction": {
"token": "Q7mRk2VxT9pLc4NwB8sHd3ZfJ6aY",
"created_at": "2026-09-30T14:15:22Z",
"updated_at": "2026-09-30T14:15:22Z",
"succeeded": true,
"transaction_type": "AddPaymentMethod",
"retained": false,
"state": "succeeded",
"message_key": "messages.transaction_succeeded",
"message": "Succeeded!",
"payment_method": {
"token": "Xc8Tn3WqL5vKp9RmZ2bHf7JdY4sA",
"created_at": "2026-09-30T14:15:22Z",
"updated_at": "2026-09-30T14:15:22Z",
"storage_state": "cached",
"test": true,
"payment_method_type": "credit_card",
"errors": [],
"fingerprint": "b5fe350d5135ab64a8f3c1097fadefd9effb",
"last_four_digits": "1111",
"first_six_digits": "411111",
"card_network": "visa",
"month": 9,
"year": 2029,
"verification_value": "123",
"number": "XXXX-XXXX-XXXX-1111",
"first_name": "Jim",
"last_name": "Halpert",
"full_name": "Jim Halpert"
}
},
"meta": {
"request_id": "c0a8012e-7f3b-4d6a-9e21-5b8d4f2a6c17",
"timestamp": "2026-09-30T14:15:22Z"
}
}{
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}⌘I
Tokenize credit card
curl --request POST \
--url https://api.fluid.app/api/v202506/payments/tokenize_card \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credit_card": {
"first_name": "Jim",
"last_name": "Halpert",
"number": "4111111111111111",
"verification_value": "123",
"month": "9",
"year": "2029",
"email": "jim.halpert@dundermifflin.com"
}
}
'import requests
url = "https://api.fluid.app/api/v202506/payments/tokenize_card"
payload = { "credit_card": {
"first_name": "Jim",
"last_name": "Halpert",
"number": "4111111111111111",
"verification_value": "123",
"month": "9",
"year": "2029",
"email": "jim.halpert@dundermifflin.com"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credit_card: {
first_name: 'Jim',
last_name: 'Halpert',
number: '4111111111111111',
verification_value: '123',
month: '9',
year: '2029',
email: 'jim.halpert@dundermifflin.com'
}
})
};
fetch('https://api.fluid.app/api/v202506/payments/tokenize_card', 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.fluid.app/api/v202506/payments/tokenize_card",
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([
'credit_card' => [
'first_name' => 'Jim',
'last_name' => 'Halpert',
'number' => '4111111111111111',
'verification_value' => '123',
'month' => '9',
'year' => '2029',
'email' => 'jim.halpert@dundermifflin.com'
]
]),
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.fluid.app/api/v202506/payments/tokenize_card"
payload := strings.NewReader("{\n \"credit_card\": {\n \"first_name\": \"Jim\",\n \"last_name\": \"Halpert\",\n \"number\": \"4111111111111111\",\n \"verification_value\": \"123\",\n \"month\": \"9\",\n \"year\": \"2029\",\n \"email\": \"jim.halpert@dundermifflin.com\"\n }\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.fluid.app/api/v202506/payments/tokenize_card")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credit_card\": {\n \"first_name\": \"Jim\",\n \"last_name\": \"Halpert\",\n \"number\": \"4111111111111111\",\n \"verification_value\": \"123\",\n \"month\": \"9\",\n \"year\": \"2029\",\n \"email\": \"jim.halpert@dundermifflin.com\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/v202506/payments/tokenize_card")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credit_card\": {\n \"first_name\": \"Jim\",\n \"last_name\": \"Halpert\",\n \"number\": \"4111111111111111\",\n \"verification_value\": \"123\",\n \"month\": \"9\",\n \"year\": \"2029\",\n \"email\": \"jim.halpert@dundermifflin.com\"\n }\n}"
response = http.request(request)
puts response.read_body{
"transaction": {
"token": "Q7mRk2VxT9pLc4NwB8sHd3ZfJ6aY",
"created_at": "2026-09-30T14:15:22Z",
"updated_at": "2026-09-30T14:15:22Z",
"succeeded": true,
"transaction_type": "AddPaymentMethod",
"retained": false,
"state": "succeeded",
"message_key": "messages.transaction_succeeded",
"message": "Succeeded!",
"payment_method": {
"token": "Xc8Tn3WqL5vKp9RmZ2bHf7JdY4sA",
"created_at": "2026-09-30T14:15:22Z",
"updated_at": "2026-09-30T14:15:22Z",
"storage_state": "cached",
"test": true,
"payment_method_type": "credit_card",
"errors": [],
"fingerprint": "b5fe350d5135ab64a8f3c1097fadefd9effb",
"last_four_digits": "1111",
"first_six_digits": "411111",
"card_network": "visa",
"month": 9,
"year": 2029,
"verification_value": "123",
"number": "XXXX-XXXX-XXXX-1111",
"first_name": "Jim",
"last_name": "Halpert",
"full_name": "Jim Halpert"
}
},
"meta": {
"request_id": "c0a8012e-7f3b-4d6a-9e21-5b8d4f2a6c17",
"timestamp": "2026-09-30T14:15:22Z"
}
}{
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}