Search for transactions
Find a single transaction
Finding a single transaction based on the UID returned to when the transaction was created is easy.
$transaction = Pencepay_Transaction::find('transaction_uid');
When searching for multiple transactions, you can use search criteria appropriate to the specific data type.
You can search for transactions using a multitude of different search filters. Depending on the data type of the search field, different search operators (e.g. is
, in
, contains
, beginsWith
, endsWith
) are available to you.
Customer
Searching for transactions based on Customer data.
$search = Pencepay_Request_TransactionSearch::build()
->billingCompany()->is('Some Company Ltd')
->billingFirstName()->is('John')
->billingLastName()->is('Hancock')
->billingLine1()->is('Street 123')
->billingLine2()->is('')
->billingCity()->is('Zagreb')
->billingPostalCode()->is('10000')
->billingCountryCode()->in(array('5111233', '1233334'));
$collection = Pencepay_Transaction::search('customer_uid', $search);
Billing address
You can search for transactions based on billing address.
$search = Pencepay_Request_TransactionSearch::build()
->billingCompany()->is('Some Company Ltd')
->billingFirstName()->is('John')
->billingLastName()->is('Hancock')
->billingLine1()->is('Street 123')
->billingLine2()->is('')
->billingCity()->is('Zagreb')
->billingPostalCode()->is('10000')
->billingCountryCode()->in(array('GB', 'DE'));
Credit Card
Searching for transactions based on CreditCard data.
$search = Pencepay_Request_TransactionSearch::build()
->cardholderName()->is('John Hancock')
->cardholderBin()->is('435010')
->cardNumberLast4()->is('1002');
Transaction properties
Search for transactions based on other properties, like transaction ID, type, payment method used etc.
$search = Pencepay_Request_TransactionSearch::build()
->ids()->in(array('5111233', '1233334'))
->paymentMethod()->in(array('VISA'))
->amount()->is(20.55)
->currencyCode()->is('EUR')
->status()->in(array('AUTHORIZED'))
->approvalCode()->is('ANB14A2')
->live()->in(array('LIVE'))
->tags()->in(array('TAG_CODE1', 'TAG_CODE2'))
->created()->greaterThanOrEqualTo(1417993999);