Vault Add Credit Card
Creates a new credit card profile, and generates a unique data key which can be obtained
from the Receipt object.
This data key is the profile identifier that all future financial Vault transactions will use to associate
with the saved information
You need to send Purchase or Preauthorization or Card verification with Credential on File fields as the first transaction before you do Vault add Credit Card.
package Canada;
import JavaAPI.*;
public class TestCanadaResAddCC
{
public static void main(String[] args)
{
String store_id = "store5";
String api_token = "yesguy";
String pan = "4242424242424242";
String expdate = "1912";
String phone = "0000000000";
String email = "bob@smith.com";
String note = "my note";
String cust_id = "customer1";
String crypt_type = "7";
String data_key_format = "0";
boolean status_check = false;
AvsInfo avsCheck = new AvsInfo();
avsCheck.setAvsStreetNumber("212");
avsCheck.setAvsStreetName("Payton Street");
avsCheck.setAvsZipCode("M1M1M1");
ResAddCC resaddcc = new ResAddCC();
resaddcc.setPan(pan);
resaddcc.setExpdate(expdate);
resaddcc.setCryptType(crypt_type);
resaddcc.setCustId(cust_id);
resaddcc.setPhone(phone);
resaddcc.setEmail(email);
resaddcc.setNote(note);
resaddcc.setAvsInfo(avsCheck);
//resaddcc.setDataKeyFormat(data_key_format); //optional
//Mandatory - Credential on File details
CofInfo cof = new CofInfo();
cof.setIssuerId("139X3130ASCXAS9"); //can be obtained by performing card verification
resaddcc.setCofInfo(cof);
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resaddcc);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
System.out.println("Cust ID = " + receipt.getResCustId());
System.out.println("Phone = " + receipt.getResPhone());
System.out.println("Email = " + receipt.getResEmail());
System.out.println("Note = " + receipt.getResNote());
System.out.println("MaskedPan = " + receipt.getResMaskedPan());
System.out.println("Exp Date = " + receipt.getResExpdate());
System.out.println("Crypt Type = " + receipt.getResCryptType());
System.out.println("Avs Street Number = " + receipt.getResAvsStreetNumber());
System.out.println("Avs Street Name = " + receipt.getResAvsStreetName());
System.out.println("Avs Zipcode = " + receipt.getResAvsZipcode());
System.out.println("IssuerId = " + receipt.getIssuerId());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault Add Credit Card transaction object definition
ResAddCC resaddcc = new ResAddCC();
HttpsPostRequest object for Vault Add Credit Card transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(resaddcc);
Vault Add Credit Card transaction object mandatory values
Vault Add Credit Card transaction object optional values
AvsInfo mandatory values
Vault Response Fields
Vault Update Credit Card
Updates an existing Vault profile (referencing the profile's unique data key) with cardholder information.
Information contained within a credit card profile is updated as indicated by the submitted fields; if any field representing an item of cardholder information is not sent in this request, that item will remain unchanged in the profile.
If the Vault profile is being updated with a new credit card number, then you first need to send a Purchase, Pre-Authorization or Card Verification transaction, with the Credential on File Info object included, before performing Vault Update Credit Card. If the credit card number is not one of the profile items being updated, this step is not required.
Things to Consider:
- To update a specific element in the profile, set that element using the corresponding set method
- When updating a credit card number, first send a Purchase, Pre-Authorization, or Card Verification with the Credential on File Info object before sending this transaction; send the issuer ID received in the response in the subsequent Vault Update Credit Card request
- If the credit card number is not one of the profile items being updated, the Credential on File info object is not required
package Canada;
import JavaAPI.*;
public class TestCanadaResUpdateCC
{
public static void main(String[] args)
{
String store_id = "moneris";
String api_token = "hurgle";
String data_key = "vthBJyN1BicbRkdWFZ9flyDP2";
String pan = "4242424242424242";
String expdate = "1901";
String phone = "0000000000";
String email = "bob@smith.com";
String note = "my note";
String cust_id = "customer1";
String crypt_type = "7";
boolean status_check = false;
AvsInfo avsCheck = new AvsInfo();
avsCheck.setAvsStreetNumber("212");
avsCheck.setAvsStreetName("Payton Street");
avsCheck.setAvsZipCode("M1M1M1");
//Credential on File details
CofInfo cof = new CofInfo();
cof.setIssuerId("139X3130ASCXAS9");
ResUpdateCC resUpdateCC = new ResUpdateCC();
resUpdateCC.setData(data_key);
resUpdateCC.setAvsInfo(avsCheck);
resUpdateCC.setCustId(cust_id);
resUpdateCC.setPan(pan);
resUpdateCC.setExpdate(expdate);
resUpdateCC.setPhone(phone);
resUpdateCC.setEmail(email);
resUpdateCC.setNote(note);
resUpdateCC.setCryptType(crypt_type);
resUpdateCC.setCofInfo(cof);
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resUpdateCC);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
System.out.println("Cust ID = " + receipt.getResCustId());
System.out.println("Phone = " + receipt.getResPhone());
System.out.println("Email = " + receipt.getResEmail());
System.out.println("Note = " + receipt.getResNote());
System.out.println("MaskedPan = " + receipt.getResMaskedPan());
System.out.println("Exp Date = " + receipt.getResExpdate());
System.out.println("Crypt Type = " + receipt.getResCryptType());
System.out.println("Avs Street Number = " + receipt.getResAvsStreetNumber());
System.out.println("Avs Street Name = " + receipt.getResAvsStreetName());
System.out.println("Avs Zipcode = " + receipt.getResAvsZipcode());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault Update Credit Card transaction object definition
ResUpdateCC resUpdateCC = new ResUpdateCC();
HttpsPostRequest object for Vault Update Credit Card transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(resUpdateCC);
Vault Update Credit Card transaction object mandatory values
Vault Update Credit Card transaction object optional values
AvsInfo optional values
Vault Response Fields
Vault Delete
Deletes an existing Vault profile of any type using the unique data key that was assigned when
the profile was added.
It is important to note that after a profile is deleted, the information which was saved within
can no longer be retrieved.
package Canada;
import JavaAPI.*;
public class TestCanadaResDelete
{
public static void main(String[] args)
{
String store_id = "moneris";
String api_token = "hurgle";
String data_key = "DxwdemrvfnoXO1HhmRikfw3gA";
boolean status_check = false;
ResDelete resDelete = new ResDelete(data_key);
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resDelete);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
//ResolveData
System.out.println("Cust ID = " + receipt.getResCustId());
System.out.println("Phone = " + receipt.getResPhone());
System.out.println("Email = " + receipt.getResEmail());
System.out.println("Note = " + receipt.getResNote());
System.out.println("MaskedPan = " + receipt.getResMaskedPan());
System.out.println("Exp Date = " + receipt.getResExpdate());
System.out.println("Crypt Type = " + receipt.getResCryptType());
System.out.println("Avs Street Number = " + receipt.getResAvsStreetNumber());
System.out.println("Avs Street Name = " + receipt.getResAvsStreetName());
System.out.println("Avs Zipcode = " + receipt.getResAvsZipcode());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault Delete transaction object definition
ResDelete resDelete = new ResDelete(data_key);
HttpsPostRequest object for Vault Delete transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(resDelete);
Vault Delete transaction object mandatory values
Vault Response Fields
Vault Tokenize Credit Card
Creates a new credit card profile using the credit card number, expiry date and e-commerce
indicator that were submitted in a previous financial transaction. Previous transactions to be tokenized must have included the Credential on File info object.
The issuer ID received in the previous transaction response is sent in the Vault Tokenize Credit Card request to reference that this is a stored credential.
As with Vault Add Credit Card, a unique data key is generated and returned to the merchant via the
Receipt object. This is the profile identifier that all future financial Vault transactions will use to
associate with the saved information.
package Canada;
import JavaAPI.*;
public class TestCanadaResTokenizeCC
{
public static void main(String[] args)
{
String store_id = "moneris";
String api_token = "hurgle";
String order_id = "mvt3212954335";
String txn_number = "199999-0_10";
String phone = "0000000000";
String email = "bob@smith.com";
String note = "my note";
String cust_id = "customer1";
String data_key_format = "0";
boolean status_check = false;
AvsInfo avsCheck = new AvsInfo();
avsCheck.setAvsStreetNumber("212");
avsCheck.setAvsStreetName("Payton Street");
avsCheck.setAvsZipCode("M1M1M1");
//Credential on File details
CofInfo cof = new CofInfo();
cof.setIssuerId("139X3130ASCXAS9");
ResTokenizeCC resTokenizeCC = new ResTokenizeCC();
resTokenizeCC.setOrderId(order_id);
resTokenizeCC.setTxnNumber(txn_number);
resTokenizeCC.setCustId(cust_id);
resTokenizeCC.setPhone(phone);
resTokenizeCC.setEmail(email);
resTokenizeCC.setNote(note);
resTokenizeCC.setAvsInfo(avsCheck);
resTokenizeCC.setCofInfo(cof);
//resTokenizeCC.setDataKeyFormat(data_key_format); //optional
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resTokenizeCC);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
//ResolveData
System.out.println("Cust ID = " + receipt.getResCustId());
System.out.println("Phone = " + receipt.getResPhone());
System.out.println("Email = " + receipt.getResEmail());
System.out.println("Note = " + receipt.getResNote());
System.out.println("MaskedPan = " + receipt.getResMaskedPan());
System.out.println("Exp Date = " + receipt.getResExpdate());
System.out.println("Crypt Type = " + receipt.getResCryptType());
System.out.println("Avs Street Number = " + receipt.getResAvsStreetNumber());
System.out.println("Avs Street Name = " + receipt.getResAvsStreetName());
System.out.println("Avs Zipcode = " + receipt.getResAvsZipcode());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault Tokenize Credit Card transaction object definition
ResTokenizeCC resTokenizeCC = new ResTokenizeCC();
HttpsPostRequest object for Vault Tokenize Credit Card transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(resTokenizeCC);
Vault Tokenize Credit Card transaction object mandatory values
Vault Tokenize Credit Card transaction object optional values
AvsInfo mandatory values
Vault Response Fields
Vault Look Up Masked
Verifies what is currently saved under the Vault profile associated with the given data key. The response to this transaction returns the latest active data for that profile.
Unlike Vault Lookup Full (which returns both the masked and the unmasked credit card numbers), this transaction only returns the masked credit card number.
package Canada;
import JavaAPI.*;
public class TestCanadaResLookupMasked
{
public static void main(String[] args)
{
String store_id = "store1";
String api_token = "yesguy";
String data_key = "pi3ZMZoTTM8pLM9wuwws2KBxw";
boolean status_check = false;
ResLookupMasked resLookupMasked = new ResLookupMasked();
resLookupMasked.setData(data_key);
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resLookupMasked);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
System.out.println("Cust ID = " + receipt.getResCustId());
System.out.println("Phone = " + receipt.getResPhone());
System.out.println("Email = " + receipt.getResEmail());
System.out.println("Note = " + receipt.getResNote());
System.out.println("MaskedPan = " + receipt.getResMaskedPan());
System.out.println("Exp Date = " + receipt.getResExpdate());
System.out.println("Crypt Type = " + receipt.getResCryptType());
System.out.println("Avs Street Number = " + receipt.getResAvsStreetNumber());
System.out.println("Avs Street Name = " + receipt.getResAvsStreetName());
System.out.println("Avs Zipcode = " + receipt.getResAvsZipcode());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault Look Up Masked transaction object definition
ResLookupMasked resLookupMasked = new ResLookupMasked();
HttpsPostRequest object for Vault Look Up Masked transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(resLookupMasked);
Vault Look Up Masked transaction object mandatory values
Vault Response Fields
Vault Look Up Full
Verifies what is currently saved under the Vault profile associated with the given data key. The response to this transaction returns the latest active data for that profile.
Unlike Vault Lookup Masked (which returns the masked credit card numbers ), this transaction returns both the masked and unmasked credit card number .
Things to consider:
- Because of the potential for fraud, permission for this transaction is not granted to all accounts by default. If it is required for your business, it must be requested via your account manager.
package Canada;
import JavaAPI.*;
public class TestCanadaResLookupFull
{
public static void main(String[] args)
{
String store_id = "store1";
String api_token = "yesguy";
String data_key = "pi3ZMZoTTM8pLM9wuwws2KBxw";
boolean status_check = false;
ResLookupFull resLookupFull = new ResLookupFull(data_key);
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resLookupFull);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
System.out.println("Cust ID = " + receipt.getResCustId());
System.out.println("Phone = " + receipt.getResPhone());
System.out.println("Email = " + receipt.getResEmail());
System.out.println("Note = " + receipt.getResNote());
System.out.println("Pan = " + receipt.getResPan());
System.out.println("MaskedPan = " + receipt.getResMaskedPan());
System.out.println("Exp Date = " + receipt.getResExpdate());
System.out.println("Crypt Type = " + receipt.getResCryptType());
System.out.println("Avs Street Number = " + receipt.getResAvsStreetNumber());
System.out.println("Avs Street Name = " + receipt.getResAvsStreetName());
System.out.println("Avs Zipcode = " + receipt.getResAvsZipcode());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault Look Up Full transaction object definition
ResLookupFull resLookupFull = new ResLookupFull(data_key);
HttpsPostRequest object for Vault Look Up Full transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(resLookupFull);
Vault Look Up Full transaction object mandatory values
Vault Response Fields
Vault is Corporate Card
Determines whether a profile has a corporate card registered within it.
After sending the transaction, the response field to the Receipt object's getCorporateCard
method is either true or false depending on whether the associated card is a corporate
card.
package Canada;
import JavaAPI.*;
public class TestCanadaResIscorporatecard
{
public static void main(String[] args)
{
String store_id = "store1";
String api_token = "yesguy";
String data_key = "eLqsADfwqHDxIpJG9vLnELx01";
boolean status_check = false;
ResIscorporatecard resIscorporatecard = new ResIscorporatecard();
resIscorporatecard.setData(data_key);
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resIscorporatecard);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("CorporateCard = " + receipt.getCorporateCard());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault is Corporate Card transaction object definition
ResIscorporatecard resIscorporatecard = new ResIscorporatecard();
HttpsPostRequest object for Vault is Corporate Card transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(ResIscorporateCard);
Vault is Corporate Card transaction object mandatory values
Vault Response Fields
Vault Get Expiring
Verifies which profiles have credit cards that are expiring during the current and next calendar
month. For example, if you are processing this transaction on September 30, then it will
return all cards that expire(d) in September and October of this year.
When generating a list of profiles with expiring credit cards, only the masked credit card numbers
are returned.
This transaction can be performed no more than 2 times on any given calendar day, and it
only applies to credit card profiles.
package Canada;
import JavaAPI.*;
public class TestCanadaResGetExpiring
{
public static void main(String[] args)
{
String store_id = "store1";
String api_token = "yesguy";
boolean status_check = false;
ResGetExpiring resGetExpiring = new ResGetExpiring();
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resGetExpiring);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
//ResolveData
for (int index =0; index < receipt.getExpiredCardCount(); index++)
{
System.out.println("\nDataKey = " + index);
System.out.println("Payment Type = " + receipt.getExpPaymentType(index));
System.out.println("Cust ID = " + receipt.getExpCustId(index));
System.out.println("Phone = " + receipt.getExpPhone(index));
System.out.println("Email = " + receipt.getExpEmail(index));
System.out.println("Note = " + receipt.getExpNote(index));
System.out.println("Masked Pan = " + receipt.getExpMaskedPan(index));
System.out.println("Exp Date = " + receipt.getExpExpdate(index));
System.out.println("Crypt Type = " + receipt.getExpCryptType(index));
System.out.println("Avs Street Number = " + receipt.getExpAvsStreetNumber(index));
System.out.println("Avs Street Name = " + receipt.getExpAvsStreetName(index));
System.out.println("Avs Zipcode = " + receipt.getExpAvsZipCode(index));
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault Get Expiring transaction object definition
ResGetExpiring resGetExpiring = new ResGetExpiring();
HttpsPostRequest object for Vault Get Expiring transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(resGetExpiring);
Vault Response Fields
Vault Add Token
Converts a Hosted Tokenization temporary token to a permanent Vault token.
A temporary token is valid for 15 minutes after it is created.
This transaction must be performed within that timeframe if the token is to be changed to a permanent one for future use.
Using the temporary token, send either Purchase, Preauthorization or Card verification with vault transaction request including the Credential on File object to get the issuer ID.
Send the vault Add Token request including the Credential on File Object (with issuer ID only, other fields are not required).
package Canada;
import JavaAPI.*;
public class TestCanadaResAddToken
{
public static void main(String[] args)
{
String store_id = "store1";
String api_token = "yesguy";
String data_key = "ot-545454ucx87A5454";
String expdate = "2001";
String phone = "0000000000";
String email = "bob@smith.com";
String note = "my note";
String cust_id = "customer1";
String crypt_type = "7";
String data_key_format = "0";
boolean status_check = false;
AvsInfo avsCheck = new AvsInfo();
avsCheck.setAvsStreetNumber("212");
avsCheck.setAvsStreetName("Payton Street");
avsCheck.setAvsZipCode("M1M1M1");
//Credential on File details
CofInfo cof = new CofInfo();
cof.setIssuerId("139X3130ASCXAS9");
ResAddToken resAddToken = new ResAddToken();
resAddToken.setDataKey(data_key);
resAddToken.setCryptType(crypt_type);
resAddToken.setExpdate(expdate);
resAddToken.setCustId(cust_id);
resAddToken.setPhone(phone);
resAddToken.setEmail(email);
resAddToken.setNote(note);
resAddToken.setAvsInfo(avsCheck);
resAddToken.setCofInfo(cof);
//resAddToken.setDataKeyFormat(data_key_format); //optional
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resAddToken);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
System.out.println("Cust ID = " + receipt.getResCustId());
System.out.println("Phone = " + receipt.getResPhone());
System.out.println("Email = " + receipt.getResEmail());
System.out.println("Note = " + receipt.getResNote());
System.out.println("MaskedPan = " + receipt.getResMaskedPan());
System.out.println("Exp Date = " + receipt.getResExpdate());
System.out.println("Crypt Type = " + receipt.getResCryptType());
System.out.println("Avs Street Number = " + receipt.getResAvsStreetNumber());
System.out.println("Avs Street Name = " + receipt.getResAvsStreetName());
System.out.println("Avs Zipcode = " + receipt.getResAvsZipcode());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault Add Token object
ResAddToken resAddToken = new ResAddToken();
HttpsPostRequest object for Vault Add Token transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(resAddToken);
Vault Add Token transaction object mandatory values
Vault Add Token transaction object conditional values
Vault Add Token transaction object optional values
AvsInfo mandatory values
Vault Response Fields
Vault Temporary Token Add
Creates a new temporary token credit card profile. This transaction requires a duration to be set to indicate how long the temporary token is to be stored for. This is the API version of Hosted Tokenization.
During the lifetime of this temporary token, it may be used for any other vault transaction before it is permanently deleted from the system.
Things to consider:
- The duration, or lifetime, of the temporary token can be set to be a maximum of 15 minutes.
package Canada;
import JavaAPI.*;
public class TestCanadaResTempAdd
{
public static void main(String[] args)
{
String store_id = "store1";
String api_token = "yesguy";
String pan = "5454545454545454";
String expdate = "1901"; //YYMM format
String crypt_type = "7";
String duration = "900";
boolean status_check = false;
ResTempAdd resTempAdd = new ResTempAdd();
resTempAdd.setPan(pan);
resTempAdd.setExpdate(expdate);
resTempAdd.setDuration(duration);
resTempAdd.setCryptType(crypt_type);
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTestMode(true); //false or comment out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(resTempAdd);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{
Receipt receipt = mpgReq.getReceipt();
System.out.println("DataKey = " + receipt.getDataKey());
System.out.println("ResponseCode = " + receipt.getResponseCode());
System.out.println("Message = " + receipt.getMessage());
System.out.println("TransDate = " + receipt.getTransDate());
System.out.println("TransTime = " + receipt.getTransTime());
System.out.println("Complete = " + receipt.getComplete());
System.out.println("TimedOut = " + receipt.getTimedOut());
System.out.println("ResSuccess = " + receipt.getResSuccess());
System.out.println("PaymentType = " + receipt.getPaymentType());
System.out.println("MaskedPan = " + receipt.getResMaskedPan());
System.out.println("Exp Date = " + receipt.getResExpdate());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Vault Temporary Token Add object
ResTempAdd resTempAdd = new ResTempAdd();
HttpsPostRequest object for Vault Temporary Token Add transaction
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(resTempAdd);
Vault Temporary Token Add transaction object mandatory values
Vault Response Fields