How It Works
The process involves these key steps:- Card Information Collection: Card information is securely collected through a form within your application and then transmitted to the Localpayment API.
- Token Generation: Localpayment securely stores the card information and generates a unique, irreversible token representing the card details. This token is returned in the API response.
- Using the Tokenized Card: For subsequent card payments, you will send the
card.tokenproperty instead of the customer’s actual card details.
Before You Begin
Before tokenizing a card, ensure you have completed the following:API Credentials
Valid API credentials and access token for authentication.
Account Setup
Proper account setup for your target country and business verification.
IP Whitelisting
Whitelist your server IP addresses for API access.
Webhook Endpoint
Set up a webhook URL to receive payment notifications.
Tokenization Methods
There are two available methods for tokenizing a card:Option 1: Endpoint for card tokenization
You can securely tokenize card information for future use through a dedicated endpoint. To tokenize a card, send aPOST request to the Tokenize Card endpoint with the following parameters:
Example Request
curl
Successful Response Example
In response, the API returns the card token:Key Response Fields
Option 2: Card tokenization during payment
Localpayment enables merchants to tokenize cards during payment processing by including thesave parameter in the payment requests. This streamlined approach allows you to both process a transaction and store card details in a single API call.
To tokenize a card, send a POST request to the Create Payin endpoint and include the card.save property set to true in your Payin request.
Example Request
curl
Successful Response Example
In response, the API returns the card token:Key Response Fields
Using Tokenized Cards
To use a tokenized card for a payment, include thecard.token in your payment request.
Example Request With Token
curl
Get Card Information
After a card has been tokenized, you can retrieve its details using the Localpayment API. This allows you to display stored payment methods to customers while maintaining PCI compliance. To obtain card information, send aGET request to the Get Card Details endpoint, including the card’s token as a query parameter.
Example Request
curl
Successful Response Example
In response, the API returns the card details:Delete a Tokenized Card
Permanently remove stored card tokens through a dedicated API endpoint. This irreversible action helps maintain compliance with data privacy regulations and allows for proper card lifecycle management. To delete a tokenized card, send aDELETE request to the Delete Tokenized Card endpoint, including the card’s token as a query parameter.
Example Request
curl
Successful Response Example
A successful deletion will typically return an empty JSON object:Next Steps
Now that you’ve successfully tokenized a card, you can use the generated token for secure processing across Localpayment’s payment services:One-Time Payments
Use the token to process single, immediate payments.
Subscriptions
Set up automated recurring billing cycles using the tokenized card.
Installments
Offer installment payment options to your customers using the tokenized card.
3D Secure
Enhance the security of tokenized card payments with 3D Secure authentication.

