Tokenization Zift
Tokenization allows you to convert a card number or bank account number into a PCI compliant token. As a Level I PCI Compliant platform we store the actual card or bank account number giving you the ability to reference it with a token for future processing. You can use the concepts and tools described below to help reduce your exposure to sensitive data and PCI scope.
Create a Token​
The tokenization
request allows you to submit a card number or bank account directly to our servers for secure storage. We will return a token which can be used to reference the card or bank account for future API calls.
By default we tokenize all credit card and bank account data sent to our servers. This allows you to easily save payment methods for your customers. The tokenization
request can be used as a standalone operation for tokenization only. The tokenization
call is typically used to help your customers manage the payment methods (cards on file) in your system.
The tokenization
call allows the use of application/JSON
.
- cURL
- Java
- JavaScript
- Python
- PHP
- Ruby
- Go
- Node.js
curl -X POST https://sandbox-secure.unipay.io/gates/xurl? \
-d "requestType=tokenization" \
-d "userName=myUsername" \
-d "password=myP%40ssword" \
-d "accountId=2001" \
-d "accountType=R" \
-d "accountNumber=5499740000000057" \
-d "accountAccessory=0422" \
-d "transactionCode=0000000001" \
-d "holderName=Tony+Stark"
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
public class PostExample {
private static int CONNECT_TIMEOUT = 10 * 1000;
private static int READ_TIMEOUT = 1 * 60 * 1000;
private static String EMPTY = "";
public static void main (String[] args) throws IOException{
System.out.println(sendPOST("https://sandbox-secure.unipay.io/gates/xurl?",
"&requestType=tokenization"
+ "&userName=myUsername"
+ "&password=myP%40ssword"
+ "&accountId=2001"
+ "&accountType=R"
+ "&accountNumber=5499740000000057"
+ "&accountAccessory=0422"
+ "&transactionCode=0000000001"
+ "&holderName=Tony+Stark"
));
}
public static String sendPOST(String url, String data) throws IOException{
HttpURLConnection conn = null;
InputStream stream = null;
URL urlLink = new URL(url);
OutputStreamWriter writer = null;
conn = (HttpURLConnection)urlLink.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setConnectTimeout(CONNECT_TIMEOUT);
conn.setReadTimeout(READ_TIMEOUT);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestMethod("POST");
writer = new OutputStreamWriter(conn.getOutputStream());
writer.write(data);
writer.flush();
writer.close();
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
stream = conn.getInputStream();
} else {
stream = conn.getErrorStream();
}
if (stream == null){
System.out.println("Response code is " + conn.getResponseCode());
return EMPTY;
}
return stream2String(stream);
}
private static String stream2String(InputStream is) throws IOException{
StringBuilder sb = new StringBuilder(8192);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = br.readLine())!= null){
sb.append(line);
}
return sb.toString();
}
}
const tokenizeCard = async () => {
const formData = new URLSearchParams();
formData.append('requestType', 'tokenization');
formData.append('userName', 'myUsername');
formData.append('password', 'myP@ssword');
formData.append('accountId', '2001');
formData.append('accountType', 'R');
formData.append('accountNumber', '5499740000000057');
formData.append('accountAccessory', '0422');
formData.append('transactionCode', '0000000001');
formData.append('holderName', 'Tony Stark');
try {
const response = await fetch('https://sandbox-secure.unipay.io/gates/xurl?', {
method: 'POST',
body: formData
});
const data = await response.text();
console.log(data);
} catch (error) {
console.error('Error:', error);
}
};
tokenizeCard();
import requests
url = "https://sandbox-secure.unipay.io/gates/xurl?"
payload = {
"requestType": "tokenization",
"userName": "myUsername",
"password": "myP@ssword",
"accountId": "2001",
"accountType": "R",
"accountNumber": "5499740000000057",
"accountAccessory": "0422",
"transactionCode": "0000000001",
"holderName": "Tony Stark"
}
response = requests.post(url, data=payload)
print(response.text)
<?php
$url = 'https://sandbox-secure.unipay.io/gates/xurl?';
$data = array(
'requestType' => 'tokenization',
'userName' => 'myUsername',
'password' => 'myP@ssword',
'accountId' => '2001',
'accountType' => 'R',
'accountNumber' => '5499740000000057',
'accountAccessory' => '0422',
'transactionCode' => '0000000001',
'holderName' => 'Tony Stark'
);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
?>
require 'net/http'
require 'uri'
uri = URI.parse('https://sandbox-secure.unipay.io/gates/xurl?')
params = {
'requestType' => 'tokenization',
'userName' => 'myUsername',
'password' => 'myP@ssword',
'accountId' => '2001',
'accountType' => 'R',
'accountNumber' => '5499740000000057',
'accountAccessory' => '0422',
'transactionCode' => '0000000001',
'holderName' => 'Tony Stark'
}
response = Net::HTTP.post_form(uri, params)
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
func main() {
apiURL := "https://sandbox-secure.unipay.io/gates/xurl?"
data := url.Values{}
data.Set("requestType", "tokenization")
data.Set("userName", "myUsername")
data.Set("password", "myP@ssword")
data.Set("accountId", "2001")
data.Set("accountType", "R")
data.Set("accountNumber", "5499740000000057")
data.Set("accountAccessory", "0422")
data.Set("transactionCode", "0000000001")
data.Set("holderName", "Tony Stark")
client := &http.Client{}
req, err := http.NewRequest("POST", apiURL, strings.NewReader(data.Encode()))
if err != nil {
panic(err)
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
const https = require('https');
const querystring = require('querystring');
const data = querystring.stringify({
'requestType': 'tokenization',
'userName': 'myUsername',
'password': 'myP@ssword',
'accountId': '2001',
'accountType': 'R',
'accountNumber': '5499740000000057',
'accountAccessory': '0422',
'transactionCode': '0000000001',
'holderName': 'Tony Stark'
});
const options = {
hostname: 'sandbox-secure.unipay.io',
port: 443,
path: '/gates/xurl?',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length
}
};
const req = https.request(options, (res) => {
let responseData = '';
res.on('data', (chunk) => {
responseData += chunk;
});
res.on('end', () => {
console.log(responseData);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(data);
req.end();
For more information, see our API Reference documentation.
Charge With a Token​
To process a transaction using a token follow the same method used in the Charge operation and replace the accountNumber
parameter with token
.
- cURL
- Java
- JavaScript
- Python
- PHP
- Ruby
- Go
- Node.js
curl -X POST https://sandbox-secure.unipay.io/gates/xurl? \
-d "requestType=sale" \
-d "userName=myUsername" \
-d "password=myP%40ssword" \
-d "accountId=2001" \
-d "amount=5000" \
-d "accountType=R" \
-d "transactionIndustryType=RE" \
-d "holderType=P" \
-d "holderName=Tony+Stark" \
-d "accountNumber=" \
-d "accountAccessory=0422" \
-d "street=12+Main+St" \
-d "city=Denver" \
-d "state=CO" \
-d "zipCode=30301" \
-d "customerAccountCode=0000000001" \
-d "transactionCode=0000000001" \
-d "token=MC10000000254965411111 " \
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
public class PostExample {
private static int CONNECT_TIMEOUT = 10 * 1000;
private static int READ_TIMEOUT = 1 * 60 * 1000;
private static String EMPTY = "";
public static void main (String[] args) throws IOException{
System.out.println(sendPOST("https://sandbox-secure.unipay.io/gates/xurl?",
"&requestType=sale"
+ "&userName=myUsername"
+ "&password=myP%40ssword"
+ "&accountId=2001"
+ "&amount=5000"
+ "&accountType=R"
+ "&transactionIndustryType=RE"
+ "&holderType=P"
+ "&holderName=Tony+Stark"
+ "&accountNumber="
+ "&accountAccessory=0422"
+ "&street=12+Main+St"
+ "&city=Denver"
+ "&state=CO"
+ "&zipCode=30301"
+ "&customerAccountCode=0000000001"
+ "&transactionCode=0000000001"
+ "&token=MC10000000254965411111 "
));
}
public static String sendPOST(String url, String data) throws IOException{
HttpURLConnection conn = null;
InputStream stream = null;
URL urlLink = new URL(url);
OutputStreamWriter writer = null;
conn = (HttpURLConnection)urlLink.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setConnectTimeout(CONNECT_TIMEOUT);
conn.setReadTimeout(READ_TIMEOUT);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestMethod("POST");
writer = new OutputStreamWriter(conn.getOutputStream());
writer.write(data);
writer.flush();
writer.close();
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
stream = conn.getInputStream();
} else {
stream = conn.getErrorStream();
}
if (stream == null){
System.out.println("Response code is " + conn.getResponseCode());
return EMPTY;
}
return stream2String(stream);
}
private static String stream2String(InputStream is) throws IOException{
StringBuilder sb = new StringBuilder(8192);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = br.readLine())!= null){
sb.append(line);
}
return sb.toString();
}
}
const chargeWithToken = async () => {
const formData = new URLSearchParams();
formData.append('requestType', 'sale');
formData.append('userName', 'myUsername');
formData.append('password', 'myP@ssword');
formData.append('accountId', '2001');
formData.append('amount', '5000');
formData.append('accountType', 'R');
formData.append('transactionIndustryType', 'RE');
formData.append('holderType', 'P');
formData.append('holderName', 'Tony Stark');
formData.append('accountNumber', '');
formData.append('accountAccessory', '0422');
formData.append('street', '12 Main St');
formData.append('city', 'Denver');
formData.append('state', 'CO');
formData.append('zipCode', '30301');
formData.append('customerAccountCode', '0000000001');
formData.append('transactionCode', '0000000001');
formData.append('token', 'MC10000000254965411111');
try {
const response = await fetch('https://sandbox-secure.unipay.io/gates/xurl?', {
method: 'POST',
body: formData
});
const data = await response.text();
console.log(data);
} catch (error) {
console.error('Error:', error);
}
};
chargeWithToken();
import urllib.parse
import urllib.request
url = 'https://sandbox-secure.unipay.io/gates/xurl?'
values = {
'requestType':'sale',
'userName':'myUsername',
'password':'myP%40ssword',
'accountId':'2001',
'amount':'5000',
'accountType':'R',
'transactionIndustryType':'RE',
'holderType':'P',
'holderName':'Tony+Stark',
'accountNumber':'',
'accountAccessory':'0422',
'street':'12+Main+St',
'city':'Denver',
'state':'CO',
'zipCode':'30301',
'customerAccountCode':'0000000001',
'transactionCode':'0000000001',
'token':'MC10000000254965411111 '
}
data = urllib.parse.urlencode(values)
data = data.encode('utf-8') # data should be bytes
req = urllib.request.Request(url, data)
with urllib.request.urlopen(req) as response:
the_page = response.read()
print(the_page)
$url = 'https://sandbox-secure.unipay.io/gates/xurl?';
$data = array(
'requestType'=>'sale',
'userName'=>'myUsername',
'password'=>'myP%40ssword',
'accountId'=>'2001',
'amount'=>'5000',
'accountType'=>'R',
'transactionIndustryType'=>'RE',
'holderType'=>'P',
'holderName'=>'Tony+Stark',
'accountNumber'=>'',
'accountAccessory'=>'0422',
'street'=>'12+Main+St',
'city'=>'Denver',
'state'=>'CO',
'zipCode'=>'30301',
'customerAccountCode'=>'0000000001',
'transactionCode'=>'0000000001',
'token'=>'MC10000000254965411111 ',
);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
require "net/https"
require "uri"
uri = URI.parse("https://sandbox-secure.unipay.io/gates/xurl?")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
post_params = {
'requestType'=>'sale',
'userName'=>'myUsername',
'password'=>'myP%40ssword',
'accountId'=>'2001',
'amount'=>'5000',
'accountType'=>'R',
'transactionIndustryType'=>'RE',
'holderType'=>'P',
'holderName'=>'Tony+Stark',
'accountNumber'=>'',
'accountAccessory'=>'0422',
'street'=>'12+Main+St',
'city'=>'Denver',
'state'=>'CO',
'zipCode'=>'30301',
'customerAccountCode'=>'0000000001',
'transactionCode'=>'0000000001',
'token'=>'MC10000000254965411111 ',
}
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data(post_params)
response = http.request(request)
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
func main() {
apiURL := "https://sandbox-secure.unipay.io/gates/xurl?"
data := url.Values{}
data.Set("requestType", "sale")
data.Set("userName", "myUsername")
data.Set("password", "myP@ssword")
data.Set("accountId", "2001")
data.Set("amount", "5000")
data.Set("accountType", "R")
data.Set("transactionIndustryType", "RE")
data.Set("holderType", "P")
data.Set("holderName", "Tony Stark")
data.Set("accountNumber", "")
data.Set("accountAccessory", "0422")
data.Set("street", "12 Main St")
data.Set("city", "Denver")
data.Set("state", "CO")
data.Set("zipCode", "30301")
data.Set("customerAccountCode", "0000000001")
data.Set("transactionCode", "0000000001")
data.Set("token", "MC10000000254965411111")
client := &http.Client{}
req, err := http.NewRequest("POST", apiURL, strings.NewReader(data.Encode()))
if err != nil {
panic(err)
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
var request = require('request');
var headers = {
'User-Agent': 'Super Agent/0.0.1',
'Content-Type': 'application/x-www-form-urlencoded'
}
var options = {
url: 'https://sandbox-secure.unipay.io/gates/xurl?',
method: 'POST',
headers: headers,
form: {
'requestType':'sale',
'userName':'myUsername',
'password':'myP%40ssword',
'accountId':'2001',
'amount':'5000',
'accountType':'R',
'transactionIndustryType':'RE',
'holderType':'P',
'holderName':'Tony+Stark',
'accountNumber':'',
'accountAccessory':'0422',
'street':'12+Main+St',
'city':'Denver',
'state':'CO',
'zipCode':'30301',
'customerAccountCode':'0000000001',
'transactionCode':'0000000001',
'token':'MC10000000254965411111 '
}
}
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
// Print out the response body
console.log(body)
}
})
Get a Token Profile​
requestType=get-profile
Use this operation to retrieve additional card holder data stored with a token for a card or bank account you have tokenized.
get-profile
only works if profiling is activated on the account. Please contact us if this is a feature you would like to use.
get-profile
only works for cards that have been tokenized after we have activated profiling on your account.
- cURL
- Java
- JavaScript
- Python
- PHP
- Ruby
- Go
- Node.js
curl -X POST https://sandbox-secure.unipay.io/gates/xurl? \
-d "requestType=get-profile" \
-d "userName=myUsername" \
-d "password=myP%40ssword" \
-d "accountId=2001" \
-d "token=XVC01P0000000084632147254611114111001111" \
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
public class PostExample {
private static int CONNECT_TIMEOUT = 10 * 1000;
private static int READ_TIMEOUT = 1 * 60 * 1000;
private static String EMPTY = "";
public static void main (String[] args) throws IOException{
System.out.println(sendPOST("https://sandbox-secure.unipay.io/gates/xurl?",
"&requestType=get-profile"
+ "&userName=myUsername"
+ "&password=myP%40ssword"
+ "&accountId=2001"
+ "&token=XVC01P0000000084632147254611114111001111"
));
}
public static String sendPOST(String url, String data) throws IOException{
HttpURLConnection conn = null;
InputStream stream = null;
URL urlLink = new URL(url);
OutputStreamWriter writer = null;
conn = (HttpURLConnection)urlLink.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setConnectTimeout(CONNECT_TIMEOUT);
conn.setReadTimeout(READ_TIMEOUT);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestMethod("POST");
writer = new OutputStreamWriter(conn.getOutputStream());
writer.write(data);
writer.flush();
writer.close();
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
stream = conn.getInputStream();
} else {
stream = conn.getErrorStream();
}
if (stream == null){
System.out.println("Response code is " + conn.getResponseCode());
return EMPTY;
}
return stream2String(stream);
}
private static String stream2String(InputStream is) throws IOException{
StringBuilder sb = new StringBuilder(8192);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = br.readLine())!= null){
sb.append(line);
}
return sb.toString();
}
}
const getTokenProfile = async () => {
const formData = new URLSearchParams();
formData.append('requestType', 'get-profile');
formData.append('userName', 'myUsername');
formData.append('password', 'myP@ssword');
formData.append('accountId', '2001');
formData.append('token', 'XVC01P0000000084632147254611114111001111');
try {
const response = await fetch('https://sandbox-secure.unipay.io/gates/xurl?', {
method: 'POST',
body: formData
});
const data = await response.text();
console.log(data);
} catch (error) {
console.error('Error:', error);
}
};
getTokenProfile();
import urllib.parse
import urllib.request
url = 'https://sandbox-secure.unipay.io/gates/xurl?'
values = {
'requestType':'get-profile',
'userName':'myUsername',
'password':'myP%40ssword',
'accountId':'2001',
'token':'XVC01P0000000084632147254611114111001111'
}
data = urllib.parse.urlencode(values)
data = data.encode('utf-8') # data should be bytes
req = urllib.request.Request(url, data)
with urllib.request.urlopen(req) as response:
the_page = response.read()
print(the_page)#
$url = 'https://sandbox-secure.unipay.io/gates/xurl?';
$data = array(
'requestType'=>'get-profile',
'userName'=>'myUsername',
'password'=>'myP%40ssword',
'accountId'=>'2001',
'token'=>'XVC01P0000000084632147254611114111001111',
);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
require "net/https"
require "uri"
uri = URI.parse("https://sandbox-secure.unipay.io/gates/xurl?")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
post_params = {
'requestType'=>'get-profile',
'userName'=>'myUsername',
'password'=>'myP%40ssword',
'accountId'=>'2001',
'token'=>'XVC01P0000000084632147254611114111001111',
}
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data(post_params)
response = http.request(request)
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
func main() {
apiURL := "https://sandbox-secure.unipay.io/gates/xurl?"
data := url.Values{}
data.Set("requestType", "get-profile")
data.Set("userName", "myUsername")
data.Set("password", "myP@ssword")
data.Set("accountId", "2001")
data.Set("token", "XVC01P0000000084632147254611114111001111")
client := &http.Client{}
req, err := http.NewRequest("POST", apiURL, strings.NewReader(data.Encode()))
if err != nil {
panic(err)
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
var request = require('request');
var headers = {
'User-Agent': 'Super Agent/0.0.1',
'Content-Type': 'application/x-www-form-urlencoded'
}
var options = {
url: 'https://sandbox-secure.unipay.io/gates/xurl?',
method: 'POST',
headers: headers,
form: {
'requestType':'get-profile',
'userName':'myUsername',
'password':'myP%40ssword',
'accountId':'2001',
'token':'XVC01P0000000084632147254611114111001111'
}
}
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
// Print out the response body
console.log(body)
}
})
For more information, see our API Reference documentation.
Proxynization.js​
Our proxynization API is a JavaScript library that can be embedded into your payment pages. This library allows you to generate temporary tokens from your payment page before data is submitted to your system helping to reduce PCI scope.
Proxynization Implementation Overview​
- Reference our proxynization.js library on your payment page. Below are production and sandbox links to our proxynization library.
- Production:
https://secure.unipay.io/services/api.proxynization.js
- Sandbox:
https://sandbox-secure.unipay.io/services/api.proxynization.js
- Production:
You may also download and host this library on your server. However, you will be responsible to make sure all library updates have been implemented when Unipay updates the proxynization.js library. You can view the Changelog to see if there are any updates to the proxynization.js library.
- Use the
authentication
request to receive a temporary password which will be valid for 10 minutes. Make sure you use the correctcontextType
when makeing the authentication call. Use:contextType=proxynization
- Submit the proxynization request with your previously received temporary password to get a proxy number;
- Use the returned proxy number in the
accountNumber
field for subsequentsale
,credit
andtokenization
requests.
See the workflow section below implementation details.
Security Constraint​
JavaScript by nature has security limitations. Since it is a client-side language its source code is entirely accessible. Therefore, it is impossible to secure passwords within JavaScript. Consequently, you should never use javascript to directly make calls to the Unipay API endpoints such as sale
or sale-auth
.
Proxynization.js Workflow​
-
Include
api.proxynization.js
Copy the following lines and paste them to your HTML page. This will enable the proxynization functionality within your application.
<script type="text/javascript" src="https://secure.unipay.io/services/api.proxynization.js"></script>
-
Implement the callback function.
The callback function will be invoked once the proxynization response is returned from our system. We generate a function call which invokes the pre-defined callback function and passes the proxynization results into it. Post-proxynization logic (such as submission of the form to your server) should be included in the callback function.
The callback function must declare three parameters:
responseCode
,responseMessage
andproxyNumber
:Parameter Description responseCode Unipay generated response code. Possible values are listed in the table. responseMessage Unipay generated response message, associated with the responseCode
value. Possible values are listed in the table.proxyNumber Temporary proxy number. Callback function example:
function clientCallback(responseCode, responseMessage, proxyNumber){
if(responseCode == "A01"){
document.getElementById('accountNumber').value = proxyNumber;
paymentForm.submit();
} else{
alert(responseMessage);
return false;
}
} -
Make the
authentication
request.Retrieve the temporary password from the
authentication
call response and assign it to the Proxynization API object. To obtain the temporary password, submit anauthentication
request, using your credentials:https://sandbox-secure.unipay.io/gates/xurl?requestType=authentication&userName=*****&password=*****&contextType=proxynization
Server-side code example:
ProxynizationAPI.password = '<?php echo (getPass()); ?>';
Final JavaScript code example:
ProxynizationAPI.password = '7e850d1d-0f94-4281-92f9-2c2c8bc8f70e';
The temporary password (such as 7e850d1d-0f94-4281-92f9-2c2c8bc8f70e
) is dynamically obtained from Unipay every time when the page is refreshed. It is valid for 10 minutes and can only be used once.
-
Implement your payment form and insert a proxynization call within the form's submit action.
process()
function takes two parameters:- The first parameter can either be the value of account number, or it can be the ID of the component from which the value can be obtained. If the value of the parameter starts with a hashtag (#) symbol, the first parameter is assumed to be the ID of the component. If a hashtag is not present, the first parameter is assumed to be an account number.
- The second parameter is the name of the callback function (previously implemented, see step 2), that will be called when the proxynization call is completed.
Proxynization call example:
<input type="button" onClick="ProxynizationAPI.process('#accountNumber','clientCallback');"/>
How to use the proxy number​
The proxynization call is used to generate a temporary token (proxy number) for a credit card or bank account number. The resulting temporary token can be substituted for the actual credit card or bank account number in various API calls such as sale
or sale-auth
.
Heads up! To indicate that the proxy number is being used within the
accountNumber
field its value should be preceded by an asterisk (*)accountNumber=*proxynumber
.