Search for customers

Find a single customer

Find a single customer based on the UID returned when the Customer was created.

$customer = Pencepay_Customer::find('customer_uid');

When searching for multiple customers, you can use search criteria appropriate to the specific property type.

Object properties

Searching based on object properties.

$search = Pencepay_Request_CustomerSearch::build()
    ->name()->is('John Hancock')
    ->firstName()->is('John')
    ->lastName()->is('Hancock')
    ->email()->is('some@email.com')
    ->phone()->is('1122334455')
    ->mobile()->is('1122334455')
    ->description()->is('test customer');

$collection = Pencepay_Customer::search($search);

Billing address

You can search for customers based on their billing address properties.

$search = Pencepay_Request_CustomerSearch::build()
    ->addressCompany()->is('Some Company Ltd')
    ->addressFirstName()->is('John')
    ->addressLastName()->is('Hancock')
    ->addressLine1()->is('Street 123')
    ->addressLine2()->is('')
    ->addressCity()->is('Zagreb')
    ->addressPostalCode()->is('10000')
    ->addressCountryCode()->in(array('GB'))
    ->created()->greaterThanOrEqualTo(1417993999);

$collection = Pencepay_Customer::search($search);