Search Overlay

Customer Vault

The Customer Vault API allows you to create customer profiles containing their payment information – i.e., tokens – and then to make repeat payments without having to directly access sensitive payment information. It is a highly efficient and secure method for enabling repeat customer payments.

Click the links below to view our code samples.

Verify That the Service Is Accessible

$isOnline = $client->customerVaultService()->monitor();
                                

Customer Profile

$profile = new Profile(array(
"merchantCustomerId" => $merchantCustomerId,
"locale" => "en_US",
"firstName" => "John",
"lastName" => "Smith",
"email" => "john.smith@somedomain.com",
"phone" => "713-444-5555"
));
$response = $client->customerVaultService()->createProfile($profile);

$profile = new Profile(array(
"merchantCustomerId" => $merchantCustomerId,
"locale" => "en_US",
"firstName" => "John",
"lastName" => "Smith",
"email" => "john.smith@somedomain.com",
"phone" => "713-444-5555",
"card" => array(
'singleUseToken' => "SCrGrrRANmOVtcVc"
)
));
$response = $client->customerVaultService()->createProfile($profile);

$response = $client->customerVaultService()->getProfile(new Profile(array('id' => $profile->id)));
                                

$profile = $client->customerVaultService()->getProfile(new Profile(array('id' => $profile->id)));
$profile->firstName = 'Jack';
$client->customerVaultService()->updateProfile($profile);

$response = $client->customerVaultService()->deleteProfile(new Profile(array('id' => $profile->id)));
                                

Profile Addresses

$address = new Address(array(
"profileID" => $profile->id,
"nickName" => "home",
"street" => "100 Queen Street West",
"street2" => "Unit 201",
"city" => "Toronto",
"country" => "CA",
"state" => "ON",
"zip" => "M5H 2N2",
"recipientName" => "Jane Doe",
"phone" => "647-788-3901"
));

$response = $client->customerVaultService()->createAddress($address);

$response = $client->customerVaultService()->getAddress(new Address(array(
'id' => $addressId,
'profileID' => $profile->id
)));

$address = $client->customerVaultService()->getAddress(new Address(array(
'id' => $addressId,
'profileID' => $profile->id
)));
$address->nickName = "NEW HOME";
$response = $client->customerVaultService()->updateAddress($address);

$response = $client->customerVaultService()->deleteAddress(new Address(array(
'id' => $addressId,
'profileID' => $profile->id,
)));

Profile Cards

$card = new Card(array(
"profileID" => $profile->id,
"nickName" => "John's corporate Visa",
"holderName" => "MR. JOHN SMITH",
"cardNum" => "4111111111111111",
"cardExpiry" => array(
'month' => "06",
'year' => "2020",
), "billingAddressId" => $addressId
));

$response = $client->customerVaultService()->createCard($card);

$response = $client->customerVaultService()->getCard(new Card(array(
'id' => $cardId,
'profileID' => $profile->id
)));

$card = $client->customerVaultService()->getCard(new Card(array(
'id' => $cardId,
'profileID' => $profile->id
)));
$card->nickName = "NEW CARD NAME";
$response = $client->customerVaultService()->updateCard($card);

$response = $client->customerVaultService()->deleteCard(new Card(array(
'id' => $cardId,
'profileID' => $profile->id,
)));

Profile Bank Accounts

Managing ACH Bank Accounts

$response = $client->customerVaultService()->createACHBankAccount(new ACHBankaccounts(array(
"accountHolderName" => "John's RBC Business Bank Account",
"accountNumber" => "511201",
"routingNumber" => 123456789"
"billingAddressId"=>”60022f38-fd17-4731-909c-923930d0d5d4”,
"accountType" =>"CHECKING"
)));

$response = $client->customerVaultService()->getACHBankAccount(new Profile(array(
"id" => “a7b218e7 - 290a - 4434 - aea2 - a1f985fc26c0”
)) , new ACHBankaccounts(array(
"id" => ”6a275b7c - 6f11 - 4ed1 - ae77 - 21071724574a”,
)));

$response = $client->customerVaultService()->updateACHBankAccount(new Profile(array(
"id" => ”a5f1889d - f1be - 4bbf - 941d - fd9b8d09d5b1”
)) , new ACHBankaccounts(array(
"id" => ”6a275b7c - 6f11 - 4ed1 - ae77 - 21071724574a”,
"accountNumber""511201",
"routingNumber" => "123456789",
"accountHolderName" => "XYZ Business",
"billingAddressId" => ”60022f38 - fd17 - 4731 - 909c - 923930d0d5d4”,
"accountType" => "SAVINGS"
)));

$response = $client->customerVaultService()->deleteACHBankAccount(new Profile(array(
"id" => ”a5f1889d - f1be - 4bbf - 941d - fd9b8d09d5b1”
)) , new ACHBankaccounts(array(
"id" => ”6a275b7c - 6f11 - 4ed1 - ae77 - 2107172457”
)));

Managing BACS Bank Accounts

$response = $client->customerVaultService()->createBACSBankAccount(new BACSBankaccounts(array(
"id" => ”a5f1889d - f1be - 4bbf - 941d - fd9b8d09d5b1”,
"iban" => "QA58DOHB00001234567890ABCDEFG",
"accountNumber" => "558844",
"sortCode" => "45698",
"accountHolderName" => "Sally's Barclays Account ",
"billingAddressId" => “a5f1889d - f1be - 4bbf - 941d - fd9b8d09d5b1”
)));

$response = $client->customerVaultService()->createBACSBankAccount(new BACSBankaccounts(array(
"id" => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1",
"iban" => "QA58DOHB00001234567890ABCDEFG",
"accountNumber" => "558844",
"sortCode" => "45698",
"accountHolderName" => "Sally's Barclays Account ",
"billingAddressId" => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1",
"mandates" => "SUBSCRIP45"
)));

$response = $client->customerVaultService()->getBACSBankAccount(new Profile(array(
"id" => ”a7b218e7 - 290a - 4434 - aea2 - a1f985fc26c0”
)) , new BACSBankaccounts(array(
"id" => ”6a275b7c - 6f11 - 4ed1 - ae77 - 21071724574a”
)));

$response = $client->customerVaultService()->updateBACSBankAccount(new Profile(array(
"id" => "a7b218e7-290a-4434-aea2-a1f985fc26c0"
)) , new BACSBankaccounts(array(
"id" => "84450406-17be-4502-a284-83cb6e31333d",
"accountNumber" => "51120172",
"routingNumber" => "123456789",
"accountHolderName" => "XYZ Business",
"billingAddressId" => "6a275b7c-6f11-4ed1-ae77-21071724574a",
"accountType" => "SAVINGS"
)));

$response = $client->customerVaultService()->deleteBACSBankAccount(new Profile(array(
"id" => ”a5f1889d - f1be - 4bbf - 941d - fd9b8d09d5b1”
)) , new BACSBankaccounts(array(
"id" => ”6a275b7c - 6f11 - 4ed1 - ae77 - 2107172457”
)));

Managing EFT Bank Accounts

$response = $client->customerVaultService()->createEFTBankAccount(new EFTBankaccounts(array(
"id" => ”60022f38 - fd17 - 4731 - 909c - 923930d0d5d4”,
"accountNumber" => “511201”,
"transitNumber" => "25039",
"institutionId" => "002",
"accountHolderName" => "Sally's Bank of Montreal Account ",
"billingAddressId" => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1"
)));

$response = $this->EFTclient->customerVaultService()->getEFTBankAccount(new Profile(array(
"id" => "6a275b7c-6f11-4ed1-ae77-21071724574a"
)) , new EFTBankaccounts(array(
"id" => "60022f38-fd17-4731-909c-923930d0d5d4"
)));

$response = $client->customerVaultService()->updateEFTBankAccount(new Profile(array(
"id" => "6a275b7c-6f11-4ed1-ae77-21071724574a"
)) , new EFTBankaccounts(array(
"id" => "d2a82a0f-142e-404d-b41d-a8704e2664e2",
"transitNumber" => "25039",
"institutionId" => "001",
"accountHolderName" => "XYZ Business",
"billingAddressId" => "6a275b7c-6f11-4ed1-ae77-21071724574a"
)));

$response = $client->customerVaultService()->deleteEFTBankAccount(new Profile(array(
"id" => "6a275b7c-6f11-4ed1-ae77-2107172457"
)) , new EFTBankaccounts(array(
"id" => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1"
)));

Managing SEPA Bank Accounts

$response = $client->customerVaultService()->createSEPABankAccount(new SEPABankaccounts(array(
"id" => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1",
"iban" => "PL37109024020000000610000434",
"accountHolderName" => "kushal",
"billingAddressId" => "60022f38-fd17-4731-909c-923930d0d5d4"
)));

$response = $client->customerVaultService()->createSEPABankAccount(new SEPABankaccounts(array(
"id" => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1",
"iban" => "PL37109024020000000610000434",
"accountHolderName" => "kushal",
"billingAddressId" => "60022f38-fd17-4731-909c-923930d0d5d4",
"mandates" => "SUBSCRIP45"
)));

$response = $client->customerVaultService()->getSEPABankAccount(new Profile(array(
"id" => "6a275b7c-6f11-4ed1-ae77-21071724574a"
)) , new SEPABankaccounts(array(
"id" => ”84450406 - 17be - 4502 - a284 - 83cb6e31333d”,
)));

$response = $client->customerVaultService()->updateSEPABankAccount(new Profile(array(
"id" => "6a275b7c-6f11-4ed1-ae77-21071724574a"
)) , new SEPABankaccounts(array(
"id" => "d2a82a0f-142e-404d-b41d-a8704e2664e2",
"accountHolderName" => "XYZ Business",
"billingAddressId" => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1",
"iban" => "AL98864022842216939118494236"
)));

$response = $client->customerVaultService()->deleteSEPABankAccount(new Profile(array(
"id" => ”6a275b7c - 6f11 - 4ed1 - ae77 - 2107172457”
)) , new SEPABankaccounts(array(
"id" => ”6a275b7c - 6f11 - 4ed1 - ae77 - 2107172457”
)));

Mandates

$response = $client->customerVaultService()->createMandates(new Mandates(array(
"reference" => "SUBSCRIP10",
"profileID" => ”a5f1889d - f1be - 4bbf - 941d - fd9b8d09d5b1”,
"bankAccountId" => “6a275b7c - 6f11 - 4ed1 - ae77 - 21071724574a”
)) , "bacsbankaccounts");

$response = $this->SEPAclient->customerVaultService()->createMandates(new Mandates(array(
"reference" => "SUBSCRIPTION103",
"profileID" => ”a5f1889d - f1be - 4bbf - 941d - fd9b8d09d5b1”,
"bankAccountId" => “6a275b7c - 6f11 - 4ed1 - ae77 - 21071724574a”
)) , "sepabankaccounts");

$response = $this->client->customerVaultService()->getMandates(new Mandates(array(
'id' => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1",
'profileID' => "6a275b7c-6f11-4ed1-ae77-21071724574a"
)));

$response = $this->client->customerVaultService()->updateMandates(new Mandates(array(
'id' => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1",
'status' => "CANCELLED",
'profileID' => "6a275b7c-6f11-4ed1-ae77-21071724574a"
)));

$response = $this->client->customerVaultService()->deleteMandates(new Mandates(array(
'id' => "e250fdeb-dceb-4953-9268-8305d06b9292",
'profileID' => "a5f1889d-f1be-4bbf-941d-fd9b8d09d5b1"
)));

Process a Payment Using a Payment Token

$response = $client->cardPaymentService()->authorize(new Authorization(array(
'merchantRefNum' => "0f8fad5bd9cb469fa16570867728950e",
'amount' => 555,
'settleWithAuth' => false,
'card' => array(
'paymentToken' => $card->paymentToken
)
)));

$response = $client->cardPaymentService()->verify(new Verification(array(
"merchantRefNum" => "0f8fad5bd9cb469fa16570867728950e",
"card" => array(
'paymentToken' => $card->paymentToken
)
)));