Php

Customers

Vatly PHP SDK - Customers

Customers

Customers represent your end users who purchase products through Vatly.

The Customer Resource

Below you'll find all properties for the Vatly Customer resource.

Properties

NameTypeDescription
idstringUnique identifier for the customer (cus_...).
emailstringCustomer's email address.
name`stringnull`
testmodeboolWhether this is a test customer.
metadataarrayYour custom metadata.
createdAtstringCreation timestamp (ISO 8601).

Create a customer

POST /v1/customers

Create a new customer.

Required attributes

NameTypeDescription
emailstringThe customer's email address.

Optional attributes

NameTypeDescription
namestringThe customer's name.
metadataarrayYour custom metadata.
$customer = $vatly->customers->create([
    'email' => 'john@example.com',
    'name' => 'John Doe',
    'metadata' => [
        'user_id' => '12345',
    ],
]);

echo $customer->id;  // cus_abc123

Retrieve a customer

GET /v1/customers/:id

Retrieve a customer by their ID.

$customer = $vatly->customers->get('cus_abc123');

echo $customer->email;
echo $customer->name;

List all customers

GET /v1/customers

Retrieve a paginated list of all your customers.

Optional attributes

NameTypeDescription
limitintegerThe number of customers to return (default: 10, max: 100).
startingAfterstringA cursor for pagination. Returns results after this customer ID.
$customers = $vatly->customers->list();

foreach ($customers as $customer) {
    echo $customer->email;
}

// Pagination
$customers = $vatly->customers->list([
    'limit' => 25,
    'startingAfter' => 'cus_last_id',
]);
Copyright © 2026