CardToken
One time use token representing card details that can be used to create a payment.
Examples
Create CardToken
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";
CardToken cardToken = CardToken.create(new PaymentsMap()
.set("card.addressCity", "OFallon")
.set("card.addressState", "MO")
.set("card.cvc", "123")
.set("card.expMonth", 11)
.set("card.expYear", 35)
.set("card.number", "5105105105105100")
);
System.out.println(cardToken);
require 'simplify'
Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"
cardToken = Simplify::CardToken.create({
"card" => {
"number" => "5105105105105100",
"expMonth" => "11",
"cvc" => "123",
"expYear" => "35",
"addressState" => "MO",
"addressCity" => "OFallon"
}
})
puts cardToken.inspect
import simplify
simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"
cardToken = simplify.CardToken.create({
"card" : {
"number" : "5105105105105100",
"expMonth" : "11",
"cvc" : "123",
"expYear" : "35",
"addressState" : "MO",
"addressCity" : "OFallon"
}
})
print(cardToken)
<?php
require_once("./lib/Simplify.php");
Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';
$cardToken = Simplify_CardToken::createCardToken(array(
'card' => array(
'number' => '5105105105105100',
'expMonth' => '11',
'cvc' => '123',
'expYear' => '35',
'addressState' => 'MO',
'addressCity' => 'OFallon'
)
));
print_r($cardToken);
?>
use Net::Simplify;
$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";
my $cardToken = Net::Simplify::CardToken->create({
card => {
number => "5105105105105100",
expMonth => "11",
cvc => "123",
expYear => "35",
addressState => "MO",
addressCity => "OFallon"
}
});
print "CardToken ID ", $cardToken->{id}, "\n";
using SimplifyCommerce.Payments;
PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";
PaymentsApi api = new PaymentsApi();
CardToken cardToken = new CardToken();
Card card = new Card();
card.AddressCity = "OFallon";
card.AddressState = "MO";
card.Cvc = "123";
card.ExpMonth = 11;
card.ExpYear = 35;
card.Number = "5105105105105100";
cardToken.Card = card;
try
{
cardToken = (CardToken)api.Create(cardToken);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
var Simplify = require("simplify-commerce"),
client = Simplify.getClient({
publicKey: 'YOUR_PUBLIC_API_KEY',
privateKey: 'YOUR_PRIVATE_API_KEY'
});
client.cardtoken.create({
card : {
number : "5105105105105100",
expMonth : "11",
cvc : "123",
expYear : "35",
addressState : "MO",
addressCity : "OFallon"
}
}, function(errData, data){
if(errData){
console.error("Error Message: " + errData.data.error.message);
// handle the error
return;
}
console.log("Success Response: " + JSON.stringify(data));
});
INPUT PARAMETERS
secure3DRequestData.id
3D Secure data ID.
optional
authenticatePayer
Set as true to create CardToken for EMV 3DS transaction.
[default:
optional
false
]
callback
The URL callback for the cardtoken
optional
card
Credit or debit card being used to apply the payment to.
required
card.addressCity
City of the cardholder.
[max length: 50, min length: 2]
optional
card.addressCountry
Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
[max length: 2, min length: 2]
optional
card.addressLine1
Address of the cardholder.
[max length: 255]
optional
card.addressLine2
Address of the cardholder if needed.
[max length: 255]
optional
card.addressState
State of residence of the cardholder. State abbreviations should be used.
[max length: 255]
optional
card.addressZip
Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
[max length: 32]
optional
card.cvc
CVC security code of the card. This is the code on the back of the card. Example: 123
optional
card.expMonth
Expiration month of the card. Format is MM. Example: January = 01
[min value: 1, max value: 12]
optional
card.expYear
Expiration year of the card. Format is YY. Example: 2013 = 13
[min value: 0, max value: 99]
optional
card.name
Name as appears on the card.
[max length: 50, min length: 2]
optional
card.number
Card number as it appears on the card.
[max length: 19, min length: 13]
optional
key
Key used to create the card token.
optional
secure3DRequestData
3D Secure data structure for checking card enrolment.
optional
secure3DRequestData.amount
Amount of the subsequent transaction in the smallest unit of your currency. Example: 100 = $1.00
[min value: 50, max value: 9999900]
required
secure3DRequestData.authOnly
Specifies if the subsequent transaction is going to be a Payment or an Authorization (to be Captured later). If false or not specified, it refers to a Payment, otherwise it refers to an Authorization.
optional
secure3DRequestData.currency
Currency code (ISO-4217). Must match the currency associated with your account.
required
secure3DRequestData.description
A description of the transaction.
[max length: 256]
optional
source
Card Token Source
[default:
optional
API
]OUTPUT
card.customer.id
Customer ID
card.id
Unique ID of the card associated with the payment
id
Unique id associated with the card token
authentication
EMV 3DS Authentication Details
card
Credit or debit card being used to apply the payment to.
card.addressCity
City of the cardholder.
card.addressCountry
Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
card.addressLine1
Address of the cardholder.
card.addressLine2
Address of the cardholder if needed.
card.addressState
State of residence of the cardholder. State abbreviations should be used.
card.addressZip
Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
card.customer
Customer associated with the card
card.customer.email
Email address of the customer
card.customer.name
Name of the customer
card.dateCreated
Creation date in UTC millis of the card in the system
card.expMonth
Expiration month of the card. Format is MM. Example: January = 01
card.expYear
Expiration year of the card. Format is YY. Example: 2013 = 13
card.indicator
Card indicator, i.e. DEBIT, CREDIT or CHARGE CARD.
card.indicatorSource
Card indicator source.
card.last4
Last 4 digits of the card number
card.name
Name as appears on the card.
card.type
Type of credit or debit card
orderId
EMV 3DS order Id
transactionId
EMV 3DS transaction Id
used
Shows if the token has been used or not.
Examples
Find CardToken
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";
CardToken cardToken = CardToken.find("4TR6Bc");
System.out.println (cardToken);
require 'simplify'
Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"
cardToken = Simplify::CardToken.find('4TR6Bc')
puts cardToken.inspect
import simplify
simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"
cardToken = simplify.CardToken.find('4TR6Bc')
print(cardToken)
<?php
require_once("./lib/Simplify.php");
Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';
$obj = Simplify_CardToken::findCardToken('4TR6Bc');
print_r($obj);
?>
use Net::Simplify;
$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";
$cardToken = Net::Simplify::CardToken->find('4TR6Bc');
print $cardToken->{id}, "\n";
using SimplifyCommerce.Payments;
using Newtonsoft.Json;
PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";
PaymentsApi api = new PaymentsApi();
try
{
String id = "1234";
CardToken cardToken = (CardToken)api.Find(typeof(CardToken), id);
// output all properties
Console.WriteLine(JsonConvert.SerializeObject(cardToken).ToString());
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
var Simplify = require("simplify-commerce"),
client = Simplify.getClient({
publicKey: 'YOUR_PUBLIC_API_KEY',
privateKey: 'YOUR_PRIVATE_API_KEY'
});
client.cardtoken.find("4TR6Bc", function(errData, data){
if(errData){
console.error("Error Message: " + errData.data.error.message);
// handle the error
return;
}
console.log("Success Response: " + JSON.stringify(data));
});
INPUT PARAMETERS
id
Object ID
required
OUTPUT
card.customer.id
Customer ID
card.id
Unique ID of the card associated with the payment
id
Unique id associated with the card token
authentication
EMV 3DS Authentication Details
card
Credit or debit card being used to apply the payment to.
card.addressCity
City of the cardholder.
card.addressCountry
Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
card.addressLine1
Address of the cardholder.
card.addressLine2
Address of the cardholder if needed.
card.addressState
State of residence of the cardholder. State abbreviations should be used.
card.addressZip
Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
card.customer
Customer associated with the card
card.customer.email
Email address of the customer
card.customer.name
Name of the customer
card.dateCreated
Creation date in UTC millis of the card in the system
card.expMonth
Expiration month of the card. Format is MM. Example: January = 01
card.expYear
Expiration year of the card. Format is YY. Example: 2013 = 13
card.indicator
Card indicator, i.e. DEBIT, CREDIT or CHARGE CARD.
card.indicatorSource
Card indicator source.
card.last4
Last 4 digits of the card number
card.name
Name as appears on the card.
card.type
Type of credit or debit card
orderId
EMV 3DS order Id
transactionId
EMV 3DS transaction Id
used
Shows if the token has been used or not.
Examples
Update CardToken
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";
CardToken cardToken = CardToken.find("4TR6Bc");
cardToken.set("device.browser", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)");
cardToken.set("device.ipAddress", "127.0.0.1");
cardToken.set("device.timeZone", "Europe/Dublin");
cardToken.update();
require 'simplify'
Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"
cardToken = Simplify::CardToken.find('4TR6Bc')
updates = {
"device" => {
"browser" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
"ipAddress" => "127.0.0.1",
"timeZone" => "Europe/Dublin"
}
}
cardToken.merge!(updates)
cardToken = cardToken.update()
puts cardToken.inspect
import simplify
simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"
cardToken = simplify.CardToken.find('4TR6Bc')
cardToken["device"] = {}
cardToken.device["browser"] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)'
cardToken.device["ipAddress"] = '127.0.0.1'
cardToken.device["timeZone"] = 'Europe/Dublin'
cardToken.update()
<?php
require_once("./lib/Simplify.php");
Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';
$cardToken = Simplify_CardToken::findCardToken('4TR6Bc');
$updates = array(
'device' => array(
'browser' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)',
'ipAddress' => '127.0.0.1',
'timeZone' => 'Europe/Dublin'
)
);
$cardToken->setAll($updates);
$cardToken->updateCardToken();
?>
use Net::Simplify;
$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";
$cardToken = Net::Simplify::CardToken->find('4TR6Bc');
$cardToken->{device}{browser} = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)";
$cardToken->{device}{ipAddress} = "127.0.0.1";
$cardToken->{device}{timeZone} = "Europe/Dublin";
$cardToken->update();
using SimplifyCommerce.Payments;
PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";
PaymentsApi api = new PaymentsApi();
string id = "1234";
CardToken cardToken = (CardToken)api.Find(typeof(CardToken), id);
APIDeviceRequestCommand device = new APIDeviceRequestCommand();
device.Browser = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)";
device.IpAddress = "127.0.0.1";
device.TimeZone = "Europe/Dublin";
cardToken.Device = device;
try
{
cardToken = (CardToken)api.Update(cardToken);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
var Simplify = require("simplify-commerce"),
client = Simplify.getClient({
publicKey: 'YOUR_PUBLIC_API_KEY',
privateKey: 'YOUR_PRIVATE_API_KEY'
});
client.cardtoken.update({
id: "4TR6Bc", // ID of object to update
device : {
browser : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
ipAddress : "127.0.0.1",
timeZone : "Europe/Dublin"
}
}, function(errData, data){
if(errData){
console.error("Error Message: " + errData.data.error.message);
// handle the error
return;
}
console.log("Success Response: " + JSON.stringify(data));
});
INPUT PARAMETERS
id
Object ID
required
device
Information about the device used by the payer for this card token transaction.
required
device.browser
The User-Agent header of the browser the customer used to place the order
required
device.ipAddress
The IP address of the device used by the payer, in nnn.nnn.nnn.nnn format.
required
device.language
The language supported for the payer's browser as defined in IETF BCP47.
optional
device.screenHeight
The total height of the payer's browser screen in pixels.
optional
device.screenWidth
The total width of the payer's browser screen in pixels.
optional
device.timeZone
The timezone of the device used by the payer, in Zone ID format. Example: "Europe/Dublin"
required
key
The public key of the merchant to be used for the token
optional
OUTPUT
card.customer.id
Customer ID
card.id
Unique ID of the card associated with the payment
id
Unique id associated with the card token
authentication
EMV 3DS Authentication Details
card
Credit or debit card being used to apply the payment to.
card.addressCity
City of the cardholder.
card.addressCountry
Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
card.addressLine1
Address of the cardholder.
card.addressLine2
Address of the cardholder if needed.
card.addressState
State of residence of the cardholder. State abbreviations should be used.
card.addressZip
Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
card.customer
Customer associated with the card
card.customer.email
Email address of the customer
card.customer.name
Name of the customer
card.dateCreated
Creation date in UTC millis of the card in the system
card.expMonth
Expiration month of the card. Format is MM. Example: January = 01
card.expYear
Expiration year of the card. Format is YY. Example: 2013 = 13
card.indicator
Card indicator, i.e. DEBIT, CREDIT or CHARGE CARD.
card.indicatorSource
Card indicator source.
card.last4
Last 4 digits of the card number
card.name
Name as appears on the card.
card.type
Type of credit or debit card
orderId
EMV 3DS order Id
transactionId
EMV 3DS transaction Id
used
Shows if the token has been used or not.