Skip to main content
Vindicia Knowledge Center

PaymentMethod.fetchByAccount

PaymentMethod.fetchByAccount

PaymentMethod.fetchByAccount

The fetchByAccount method returns one or more PaymentMethod objects whose Account object matches the input. You can, for example, call this method to retrieve the payment methods a customer has used before, present them to the customer, and ask them to choose one for a new product or subscription purchase.

Input

srd: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a method call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the srd. A null srd returns the complete response.

account: the Account object that serves as the search criterion. Use the merchantAccountId or VID to identify the object.

includeChildren: an optional Boolean flag that, if set to true, includes any children associated with this Account. If this flag is omitted, CashBox will interpret it as false, and constructs the query without looking at any child's account.

Output

return: an object of type Return that indicates the success or failure of the call.

paymentMethods: an array of one or more active PaymentMethod objects associated with the Account object specified in the input.

Returns

In addition to those listed in Standard Return Codes, this call returns:

Return Code

Return String

400

Account parameter is required.

404

One of the following:

  • No PaymentMethods found for account.
  • Account not found.

Example

$merchantId = '12345';

// Create a payment method object to make the call

$paymentMethod = new PaymentMethod();

// Create an account object to search the payment methods by

$account = new Account();
$account->setMerchantAccountId('abc101');

$response = $paymentMethod->fetchByAccount($account);
if($response['returnCode'] == 200) {

$fetchedPms = $response['data']->paymentMethods;

if($fetchedPms != null) {

foreach ($fetchedPms as $pm) {

// process a fetched payment method object here

$accountHolder = $pm->getAccountHolderName();
if ($pm->getType() == "CreditCard") {
$cc = $pm->getCreditCard();

// process other credit card attributes here

}

}

}

}

For Users

Learn More
For Users

Cashbox Features

Learn More
Cashbox Features
Back to Top