curl --request POST \
--url https://gateway.paybyrd.com/api/v2/tokens \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"Type": "Card",
"CustomReference": "Wallet123",
"Alias": "MyShoppingCard",
"RedirectUrl": "http://client.co/3ds/validation?token=123456",
"Card": {
"number": "5149682323738886",
"expiration": "03/29",
"cvv": "929",
"holder": "Peter Parker",
"aav": "<string>",
"dsTransactionId": "<string>",
"eci": "<string>",
"xid": "<string>"
}
}
'import requests
url = "https://gateway.paybyrd.com/api/v2/tokens"
payload = {
"Type": "Card",
"CustomReference": "Wallet123",
"Alias": "MyShoppingCard",
"RedirectUrl": "http://client.co/3ds/validation?token=123456",
"Card": {
"number": "5149682323738886",
"expiration": "03/29",
"cvv": "929",
"holder": "Peter Parker",
"aav": "<string>",
"dsTransactionId": "<string>",
"eci": "<string>",
"xid": "<string>"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
Type: 'Card',
CustomReference: 'Wallet123',
Alias: 'MyShoppingCard',
RedirectUrl: 'http://client.co/3ds/validation?token=123456',
Card: {
number: '5149682323738886',
expiration: '03/29',
cvv: '929',
holder: 'Peter Parker',
aav: '<string>',
dsTransactionId: '<string>',
eci: '<string>',
xid: '<string>'
}
})
};
fetch('https://gateway.paybyrd.com/api/v2/tokens', 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://gateway.paybyrd.com/api/v2/tokens",
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([
'Type' => 'Card',
'CustomReference' => 'Wallet123',
'Alias' => 'MyShoppingCard',
'RedirectUrl' => 'http://client.co/3ds/validation?token=123456',
'Card' => [
'number' => '5149682323738886',
'expiration' => '03/29',
'cvv' => '929',
'holder' => 'Peter Parker',
'aav' => '<string>',
'dsTransactionId' => '<string>',
'eci' => '<string>',
'xid' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://gateway.paybyrd.com/api/v2/tokens"
payload := strings.NewReader("{\n \"Type\": \"Card\",\n \"CustomReference\": \"Wallet123\",\n \"Alias\": \"MyShoppingCard\",\n \"RedirectUrl\": \"http://client.co/3ds/validation?token=123456\",\n \"Card\": {\n \"number\": \"5149682323738886\",\n \"expiration\": \"03/29\",\n \"cvv\": \"929\",\n \"holder\": \"Peter Parker\",\n \"aav\": \"<string>\",\n \"dsTransactionId\": \"<string>\",\n \"eci\": \"<string>\",\n \"xid\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://gateway.paybyrd.com/api/v2/tokens")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Type\": \"Card\",\n \"CustomReference\": \"Wallet123\",\n \"Alias\": \"MyShoppingCard\",\n \"RedirectUrl\": \"http://client.co/3ds/validation?token=123456\",\n \"Card\": {\n \"number\": \"5149682323738886\",\n \"expiration\": \"03/29\",\n \"cvv\": \"929\",\n \"holder\": \"Peter Parker\",\n \"aav\": \"<string>\",\n \"dsTransactionId\": \"<string>\",\n \"eci\": \"<string>\",\n \"xid\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.paybyrd.com/api/v2/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Type\": \"Card\",\n \"CustomReference\": \"Wallet123\",\n \"Alias\": \"MyShoppingCard\",\n \"RedirectUrl\": \"http://client.co/3ds/validation?token=123456\",\n \"Card\": {\n \"number\": \"5149682323738886\",\n \"expiration\": \"03/29\",\n \"cvv\": \"929\",\n \"holder\": \"Peter Parker\",\n \"aav\": \"<string>\",\n \"dsTransactionId\": \"<string>\",\n \"eci\": \"<string>\",\n \"xid\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"card": {
"number": "514968******8886",
"expiration": "03/29",
"cvv": "***",
"holder": "Peter Parker",
"aav": "<string>",
"dsTransactionId": "<string>",
"eci": "<string>",
"xid": "<string>",
"countryCode": "PRT"
},
"tokenId": "5d3491c3-8978-4ff5-8d74-31b0b0499b01",
"customReference": "Wallet123",
"alias": "PersonalCard",
"action": {
"type": "redirect",
"url": "https://gateway.paybyrd.com/v1/ThreeDSecure/InitiatePayment?transactionId=0411c4cf-3d6c-4315-ac5e-98fb1d72f11f"
}
}Create Token
Create a Token for future transactions
curl --request POST \
--url https://gateway.paybyrd.com/api/v2/tokens \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"Type": "Card",
"CustomReference": "Wallet123",
"Alias": "MyShoppingCard",
"RedirectUrl": "http://client.co/3ds/validation?token=123456",
"Card": {
"number": "5149682323738886",
"expiration": "03/29",
"cvv": "929",
"holder": "Peter Parker",
"aav": "<string>",
"dsTransactionId": "<string>",
"eci": "<string>",
"xid": "<string>"
}
}
'import requests
url = "https://gateway.paybyrd.com/api/v2/tokens"
payload = {
"Type": "Card",
"CustomReference": "Wallet123",
"Alias": "MyShoppingCard",
"RedirectUrl": "http://client.co/3ds/validation?token=123456",
"Card": {
"number": "5149682323738886",
"expiration": "03/29",
"cvv": "929",
"holder": "Peter Parker",
"aav": "<string>",
"dsTransactionId": "<string>",
"eci": "<string>",
"xid": "<string>"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
Type: 'Card',
CustomReference: 'Wallet123',
Alias: 'MyShoppingCard',
RedirectUrl: 'http://client.co/3ds/validation?token=123456',
Card: {
number: '5149682323738886',
expiration: '03/29',
cvv: '929',
holder: 'Peter Parker',
aav: '<string>',
dsTransactionId: '<string>',
eci: '<string>',
xid: '<string>'
}
})
};
fetch('https://gateway.paybyrd.com/api/v2/tokens', 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://gateway.paybyrd.com/api/v2/tokens",
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([
'Type' => 'Card',
'CustomReference' => 'Wallet123',
'Alias' => 'MyShoppingCard',
'RedirectUrl' => 'http://client.co/3ds/validation?token=123456',
'Card' => [
'number' => '5149682323738886',
'expiration' => '03/29',
'cvv' => '929',
'holder' => 'Peter Parker',
'aav' => '<string>',
'dsTransactionId' => '<string>',
'eci' => '<string>',
'xid' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://gateway.paybyrd.com/api/v2/tokens"
payload := strings.NewReader("{\n \"Type\": \"Card\",\n \"CustomReference\": \"Wallet123\",\n \"Alias\": \"MyShoppingCard\",\n \"RedirectUrl\": \"http://client.co/3ds/validation?token=123456\",\n \"Card\": {\n \"number\": \"5149682323738886\",\n \"expiration\": \"03/29\",\n \"cvv\": \"929\",\n \"holder\": \"Peter Parker\",\n \"aav\": \"<string>\",\n \"dsTransactionId\": \"<string>\",\n \"eci\": \"<string>\",\n \"xid\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://gateway.paybyrd.com/api/v2/tokens")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Type\": \"Card\",\n \"CustomReference\": \"Wallet123\",\n \"Alias\": \"MyShoppingCard\",\n \"RedirectUrl\": \"http://client.co/3ds/validation?token=123456\",\n \"Card\": {\n \"number\": \"5149682323738886\",\n \"expiration\": \"03/29\",\n \"cvv\": \"929\",\n \"holder\": \"Peter Parker\",\n \"aav\": \"<string>\",\n \"dsTransactionId\": \"<string>\",\n \"eci\": \"<string>\",\n \"xid\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.paybyrd.com/api/v2/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Type\": \"Card\",\n \"CustomReference\": \"Wallet123\",\n \"Alias\": \"MyShoppingCard\",\n \"RedirectUrl\": \"http://client.co/3ds/validation?token=123456\",\n \"Card\": {\n \"number\": \"5149682323738886\",\n \"expiration\": \"03/29\",\n \"cvv\": \"929\",\n \"holder\": \"Peter Parker\",\n \"aav\": \"<string>\",\n \"dsTransactionId\": \"<string>\",\n \"eci\": \"<string>\",\n \"xid\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"card": {
"number": "514968******8886",
"expiration": "03/29",
"cvv": "***",
"holder": "Peter Parker",
"aav": "<string>",
"dsTransactionId": "<string>",
"eci": "<string>",
"xid": "<string>",
"countryCode": "PRT"
},
"tokenId": "5d3491c3-8978-4ff5-8d74-31b0b0499b01",
"customReference": "Wallet123",
"alias": "PersonalCard",
"action": {
"type": "redirect",
"url": "https://gateway.paybyrd.com/v1/ThreeDSecure/InitiatePayment?transactionId=0411c4cf-3d6c-4315-ac5e-98fb1d72f11f"
}
}Authorizations
Body
Identity the type of the token (currently only "card")
"Card"
Identify the token by an aggregation reference of your business (CustomerId, WalletId, StoreId ...)
"Wallet123"
Alias for the new token (usually provided by the customer)
"MyShoppingCard"
The url that redirect the user at the end of 3ds validation (in fail, succes and reject cases)
"http://client.co/3ds/validation?token=123456"
Show child attributes
Show child attributes
"transactionMode" is used for tokenization and tokenized payments. The value "initialUnescheduled" tokenizes details for future one-time, unscheduled payments. The value "initialRecurring' tokenizes details for the first in a series of scheduled payments. The value "cardHolderInitiatedUnescheduled" is for subsequent unscheduled payment initiated by the cardholder. The value "merchantInitiatedUnescheduled" is for unscheduled payment initiated by the merchant. The value "merchantInitiatedRecurring" is for subsequent scheduled payment initiated by the merchant.
initialUnescheduled, initialRecurring, cardHolderInitiatedUnescheduled, merchantInitiatedUnescheduled, merchantInitiatedRecurring Response
201
Show child attributes
Show child attributes
The id of generated token
"5d3491c3-8978-4ff5-8d74-31b0b0499b01"
The customReference sent in the CardTokenizeRequest
"Wallet123"
The Alias sent in the CardTokenizeRequest
"PersonalCard"
Show child attributes
Show child attributes

