vatly / vatly-api-php
Vatly API client for PHP
Requires
- php: ^8.0
- ext-curl: *
- ext-json: *
- ext-openssl: *
- composer/ca-bundle: ^1.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
- guzzlehttp/guzzle: ^7.5
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5
- spatie/ray: ^1.19
- dev-main
- v0.1.0-alpha.5
- v0.1.0-alpha.4
- v0.1.0-alpha.3
- v0.1.0-alpha.2
- v0.1.0-alpha.1
- dev-chore/sync-openapi-self-service-link-renames
- dev-claude/awesome-beaver-2bfc55
- dev-chore/rename-update-link-methods
- dev-claude/crazy-banzai-bec81b
- dev-feat/add-link-to-docs-from-main-readme
- dev-sandervanhooft/check-idempotency
- dev-sync-openapi-sdk
- dev-sandervanhooft/sync-openapi-sdk
- dev-fix/chargeback-id-prefix
- dev-fix/align-docs-with-openapi-spec
- dev-feature/comprehensive-docs
- dev-feature/sync-openapi-spec
This package is auto-updated.
Last update: 2026-05-21 22:08:16 UTC
README
Sell worldwide, today, with Vatly. Dedicated to EU based SAAS merchants and software companies, accept creditcard, PayPal, ApplePay, iDEAL and more.
Using a framework?
This is the raw API client. If you're building a Laravel application, you almost certainly want vatly/vatly-laravel instead — it provides a Cashier-style Billable trait, Eloquent models, a wired webhook endpoint, and event-bus integration on top of this SDK.
Other framework drivers (Symfony, WordPress) are on the roadmap. To build one, see the Driver Author Guide in vatly/vatly-fluent-php.
Installation
You can install the package via composer:
composer require vatly/vatly-api-php
Usage
use Vatly\API\VatlyApiClient; $vatly = new VatlyApiClient(); $vatly->setApiKey('test_your_api_key_here'); $vatly->checkouts->create([...]);
Idempotency
The SDK automatically sends an Idempotency-Key header on every POST and PATCH request.
$checkout = $vatly->checkouts->create([ 'products' => [ ['id' => 'plan_abc123', 'quantity' => 1], ], 'redirectUrlSuccess' => 'https://yourapp.com/success', 'redirectUrlCanceled' => 'https://yourapp.com/canceled', ]);
To set a custom key for the next mutating request, use setIdempotencyKey(). The manual key is cleared after the request is sent.
$vatly->setIdempotencyKey('checkout-create-123'); $checkout = $vatly->checkouts->create([ 'products' => [ ['id' => 'plan_abc123', 'quantity' => 1], ], 'redirectUrlSuccess' => 'https://yourapp.com/success', 'redirectUrlCanceled' => 'https://yourapp.com/canceled', ]);
Some endpoint methods also accept a per-request idempotencyKey option:
$checkout = $vatly->checkouts->create([...], [ 'idempotencyKey' => 'checkout-create-123', ]); $subscription = $vatly->subscriptions->update('subscription_123', [ 'quantity' => 2, ], [ 'idempotencyKey' => 'subscription-update-123', ]);
You can replace or disable the automatic generator when needed:
$vatly->setIdempotencyKeyGenerator(new MyIdempotencyKeyGenerator()); $vatly->clearIdempotencyKeyGenerator();
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Send in a Pull Request if you'd like to contribute to this package.
Security Vulnerabilities
In case of a security vulnerability, please shoot us an email at security@vatly.com.
Credits
License
The MIT License (MIT). Please see License File for more information.