Php

Refunds

Vatly PHP SDK - Refunds

Refunds

Refunds allow you to return money to your customers for orders.

The Refund Resource

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

Properties

NameTypeDescription
idstringUnique identifier for the refund (ref_...).
statusstringThe status: pending, completed, failed, or canceled.
orderIdstringThe order ID being refunded.
amountintegerRefund amount in cents.
currencystringThree-letter ISO currency code.
reason`stringnull`
testmodeboolWhether this is a test refund.
metadataarrayYour custom metadata.
createdAtstringCreation timestamp (ISO 8601).

Create a refund

POST /v1/refunds

Create a refund for an order.

Required attributes

NameTypeDescription
orderIdstringThe ID of the order to refund.

Optional attributes

NameTypeDescription
amountintegerPartial refund amount in cents (omit for full refund).
reasonstringReason for the refund.
// Full refund
$refund = $vatly->refunds->create([
    'orderId' => 'ord_abc123',
    'reason' => 'Customer requested refund',
]);

// Partial refund
$refund = $vatly->refunds->create([
    'orderId' => 'ord_abc123',
    'amount' => 1000,  // Refund €10.00
]);

echo $refund->id;
echo $refund->status;

Retrieve a refund

GET /v1/refunds/:id

Retrieve a refund by its ID.

$refund = $vatly->refunds->get('ref_abc123');

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

List all refunds

GET /v1/refunds

Retrieve a paginated list of all refunds.

Optional attributes

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

foreach ($refunds as $refund) {
    echo $refund->id . ': ' . $refund->status;
}

Refund statuses

StatusDescription
pendingRefund is being processed
completedRefund completed successfully
failedRefund failed
canceledRefund was canceled

Helper methods

The Refund object provides convenient helper methods.

$refund->isPending();     // true if status is 'pending'
$refund->isCompleted();   // true if status is 'completed'
$refund->isFailed();      // true if status is 'failed'
$refund->isCanceled();    // true if status is 'canceled'
Copyright © 2026