Card Tokenizer Service API Integration Guide

This document provides detailed instructions for integrating with the publicly accessible endpoints of the Card Tokenizer Service API. These endpoints allow merchants to tokenize card data and manage tokenized cards securely, with support for iFrame integration for card input.

Base URL

The base URL for all API endpoints depends on the environment:

Use the appropriate base URL for your environment in all requests described below.

Authentication

Some endpoints require authentication using an auth_token, which must be obtained via the /api/get-iframe-key endpoint. The auth_token is then passed in the Authorization header as a Bearer token for subsequent requests.

Step 1: Obtain an auth_token

Use the /api/get-iframe-key endpoint to generate an auth_token.

Request

Example Secret Calculation:

const login = "test@example.com";
const plainText = "2025-04-25-12:00:00-550e8400-e29b-41d4-a716-446655440000";
const secretCode = "your_secret_code"; // Provided by the service
const hashInput = `${login};${plainText};${secretCode}`;
const secret = CryptoJS.SHA256(hashInput).toString(CryptoJS.enc.Base64);

Response

Error Responses:

Example

curl -X POST https://test-tokenizer.paymaster24.com/api/get-iframe-key \
-H "Content-Type: application/json" \
-d '{
"login": "test@example.com",
"plain_text": "2025-04-25-12:00:00-550e8400-e29b-41d4-a716-446655440000",
"secret": "base64_encoded_sha256"
}'

Step 2: Set Up Authorization Header

Use the obtained auth_token in the Authorization header for all subsequent requests that require it:

Authorization: Bearer <auth_token>

Public Endpoints

1. Display Card Tokenizer iFrame (GET /card-tokenizer)

This endpoint renders an iFrame form for securely collecting card details.

Request

Response

Error Responses:

Example

curl -X GET "https://test-tokenizer.paymaster24.com/card-tokenizer?login=test@example.com&plain_text=2025-04-25-12:00:00-550e8400-e29b-41d4-a716-446655440000&secret=base64_encoded_sha256&customer_id=1234597&lang=en&post_url=https://merchant.com/123"

2. Generate Authentication Token (POST /api/get-iframe-key)

This endpoint generates an auth_token for iFrame authorization and subsequent API requests.

Request

Response

Error Responses:

Example

curl -X POST https://test-tokenizer.paymaster24.com/api/get-iframe-key \
-H "Content-Type: application/json" \
-d '{
"login": "test@example.com",
"plain_text": "2025-04-25-12:00:00-550e8400-e29b-41d4-a716-446655440000",
"secret": "base64_encoded_sha256"
}'

iFrame Integration

The /card-tokenizer endpoint provides an iFrame that can be embedded into a merchant's webpage to securely collect card details from customers. The iFrame handles card input and tokenization, ensuring that sensitive card data does not touch the merchant's servers.

Steps for iFrame Integration

  1. Obtain Required Parameters:
    • Generate a unique plain_text in the format YYYY-MM-DD-HH:mm:ss-<uuid>.
    • Calculate the secret using the formula SHA256(login;plain_text;secret_code) with your provided secret_code.
    • Use the merchant's email as the login.
    • Optionally, provide a post_url for receiving tokenization results.
    • cardholder_name (optional): The cardholder's name for verification purposes. If this field is empty or omitted, no cardholder name verification will be performed.
  2. Embed the iFrame:
    • Use the /card-tokenizer endpoint URL with the required query parameters.
    • Embed the URL in an <iframe> tag on your webpage.
  3. Handle Tokenization:
    • After successful tokenization, the iFrame will display the result directly within itself. If a post_url is provided, the tokenization result will also be sent to that URL via a POST request.

Example iFrame Integration

Below is an example of how to integrate the card tokenizer iFrame into a merchant's webpage:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Merchant Card Payment Page</title>
<style>
    iframe {
        width: 100%;
        height: 400px;
        border: none;
    }
</style>
</head>
<body>
<h1>Enter Your Card Details</h1>
<iframe
    src="https://test-tokenizer.paymaster24.com/card-tokenizer?login=test@example.com&plain_text=2025-04-25-12:00:00-550e8400-e29b-41d4-a716-446655440000&secret=base64_encoded_sha256&lang=en&post_url=https://webhook-test.com/f25df8b4cc57d32a49c2cb6940118339"
    title="Card Tokenizer iFrame"
></iframe>
</body>
</html>

Notes on iFrame Integration

Additional Endpoints (Authentication Required)

The following endpoints require authentication via the Authorization header. They are accessible to authorized users who have obtained an auth_token.

1. Retrieve Card Metadata (GET /api/card-metadata)

This endpoint retrieves metadata for a tokenized card.

Request

Response

Error Responses:

Example

curl -X GET "https://test-tokenizer.paymaster24.com/api/card-metadata?token=fd7355715eda4d8d80c1334435d79dcf&merchant_id=merchant_test@example.com" \
-H "Authorization: Bearer <auth_token>"

2. Retrieve Tokens by Merchant and Customer (GET /api/tokens)

This endpoint retrieves a list of tokens associated with a specific merchant and customer.

Request

Response

Error Responses:

Example

curl -X GET "https://test-tokenizer.paymaster24.com/api/tokens?merchant_id=merchant_test@example.com&ext_customer_id=1745915011" \
-H "Authorization: Bearer <auth_token>"

3. Delete Token (POST /api/token/delete)

This endpoint deletes a tokenized card.

Request

Response

Error Responses:

Example

curl -X POST https://test-tokenizer.paymaster24.com/api/token/delete \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <auth_token>" \
-d '{
"token": "fd7355715eda4d8d80c1334435d79dcf",
"merchant_id": "merchant_test@example.com"
}'

Error Handling

Best Practices

Contact Support

For further assistance or to report issues, contact the API support team at support@paymaster24.com.