Vatly
Php

Customers

Vatly PHP SDK - 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 (customer_...).
emailstringCustomer's email address.
namestring | nullCustomer's name.
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;  // customer_abc123

Retrieve a customer

GET /v1/customers/:id

Retrieve a customer by their ID.

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

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

Update a customer

PATCH /v1/customers/:id

Update a customer's identity fields. Only name and email may be changed, and both are optional — send whichever you want to update. Billing-address details (company name, tax ID, street, city, country, etc.) are not editable here; amend those through the hosted billing-update flow.

Optional attributes

NameTypeDescription
namestring | nullThe customer's name. Pass null to clear it.
emailstringThe customer's email address.
$customer = $vatly->customers->update('customer_abc123', [
    'name' => 'Jane Doe',
    'email' => 'jane@example.com',
]);

echo $customer->name; // Jane Doe

If you already have a Customer resource instance:

$customer->update([
    'name' => 'Jane Doe',
]);

The SDK generates an idempotency key automatically for the PATCH request, or you can set your own via $vatly->setIdempotencyKey(...) beforehand.


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' => 'customer_last_id',
]);
Copyright © 2026