Guides
Vatly SDKs
Vatly offers official SDKs to make integrating the API into your application quick and easy.
PHP SDK
The official PHP SDK is the primary way to interact with the Vatly API from your PHP application.
Installation
composer require vatly/vatly-api-php
Quick example
$vatly = new \Vatly\API\VatlyApiClient();
$vatly->setApiKey('live_your_api_key_here');
// Create a checkout
$checkout = $vatly->checkouts->create([
'products' => [
['id' => 'plan_abc123', 'quantity' => 1],
],
'redirectUrlSuccess' => 'https://example.com/success',
'redirectUrlCanceled' => 'https://example.com/canceled',
]);
// Redirect to the hosted checkout page
header('Location: ' . $checkout->links->checkoutUrl->href, true, 303);
Resources
The PHP SDK provides convenient access to all Vatly API resources:
| Resource | Usage |
|---|---|
| Customers | $vatly->customers->page(), ->create(), ->get() |
| Checkouts | $vatly->checkouts->page(), ->create(), ->get() |
| Subscriptions | $vatly->subscriptions->page(), ->get(), ->update(), ->cancel() |
| Subscription Plans | $vatly->subscriptionPlans->page(), ->get() |
| Orders | $vatly->orders->page(), ->get() |
| Refunds | $vatly->refunds->page(), ->get() |
| Order Refunds | $vatly->orders->refunds($orderId)->create(), ->page(), ->get() |
| Chargebacks | $vatly->chargebacks->page(), ->get() |
| One-off Products | $vatly->oneOffProducts->page(), ->get() |
Other languages
Support for additional languages is planned:
| Language | Status |
|---|---|
| PHP | Available |
| JavaScript / Node.js | Coming soon |
| Python | Coming soon |
| Ruby | Coming soon |
In the meantime, you can use the REST API directly with any HTTP client in any language.