Php

Orders

Vatly PHP SDK - Orders

Orders

Orders are created automatically when a checkout completes successfully or when a subscription renews.

The Order Resource

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

Properties

NameTypeDescription
idstringUnique identifier for the order (ord_...).
statusstringThe status: pending, paid, or failed.
customerIdstringThe customer ID.
checkoutId`stringnull`
subscriptionId`stringnull`
amountintegerTotal amount in cents.
currencystringThree-letter ISO currency code.
taxAmountintegerTax amount in cents.
testmodeboolWhether this is a test order.
metadataarrayYour custom metadata.
paidAt`stringnull`
createdAtstringCreation timestamp (ISO 8601).

Retrieve an order

GET /v1/orders/:id

Retrieve an order by its ID.

$order = $vatly->orders->get('ord_abc123');

echo $order->status;
echo $order->amount / 100 . ' ' . $order->currency;

if ($order->isPaid()) {
    echo 'Paid at: ' . $order->paidAt;
}

List all orders

GET /v1/orders

Retrieve a paginated list of all orders.

Optional attributes

NameTypeDescription
limitintegerThe number of orders to return (default: 10, max: 100).
startingAfterstringA cursor for pagination.
customerIdstringFilter by customer ID.
$orders = $vatly->orders->list();

foreach ($orders as $order) {
    echo $order->id . ': ' . ($order->amount / 100) . ' ' . $order->currency;
}

// Filter by customer
$orders = $vatly->orders->list([
    'customerId' => 'cus_abc123',
]);

Order statuses

StatusDescription
pendingOrder is awaiting payment
paidPayment successful
failedPayment failed

Helper methods

The Order object provides convenient helper methods.

$order->isPaid();      // true if status is 'paid'
$order->isPending();   // true if status is 'pending'
$order->isFailed();    // true if status is 'failed'
Copyright © 2026