PHPackages                             vatly/vatly-api-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. vatly/vatly-api-php

ActiveLibrary[Payment Processing](/categories/payments)

vatly/vatly-api-php
===================

Vatly API client for PHP

v0.1.0-alpha.22(4w ago)22.4k—5.7%[4 issues](https://github.com/Vatly/vatly-api-php/issues)[1 PRs](https://github.com/Vatly/vatly-api-php/pulls)2MITPHPPHP ^8.0CI passing

Since Feb 26Pushed 1w agoCompare

[ Source](https://github.com/Vatly/vatly-api-php)[ Packagist](https://packagist.org/packages/vatly/vatly-api-php)[ Docs](https://www.vatly.com)[ RSS](/packages/vatly-vatly-api-php/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (42)Versions (58)Used By (2)

[![Vatly API client for PHP](art/banner.png)](art/banner.png)

Vatly API client for PHP
========================

[](#vatly-api-client-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ceb7e46c620c95c5723838f4f67133afc7aa0cd939119a5892f13406b4843247/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7661746c792f7661746c792d6170692d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vatly/vatly-api-php)[![Tests](https://github.com/Vatly/vatly-api-php/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/Vatly/vatly-api-php/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/efb0b0f35ef409eac4df822c94e4a2cdf163912ba5828e280414ccc6848dddb0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7661746c792f7661746c792d6170692d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vatly/vatly-api-php)

Sell worldwide, today, with Vatly. Dedicated to EU based SAAS merchants and software companies, accept creditcard, PayPal, ApplePay, iDEAL and more.

Using a framework?
------------------

[](#using-a-framework)

This is the raw API client. If you're building a Laravel application, you almost certainly want [`vatly/vatly-laravel`](https://github.com/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](https://github.com/Vatly/vatly-fluent-php/blob/main/CONTRIBUTING.md) in [`vatly/vatly-fluent-php`](https://github.com/Vatly/vatly-fluent-php).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require vatly/vatly-api-php
```

Usage
-----

[](#usage)

```
use Vatly\API\VatlyApiClient;

$vatly = new VatlyApiClient();
$vatly->setApiKey('test_your_api_key_here');

$vatly->checkouts->create([...]);
```

For detailed documentation, see [docs/README.md](docs/README.md).

> **Source of truth.** The complete, canonical schema for every request and response — including fields the guides below don't spell out — lives in the [OpenAPI spec](https://docs.vatly.com/openapi.yaml). If you (or an AI assistant) are unsure whether a field exists or what it's called, check the spec rather than guessing from an example.

Idempotency
-----------

[](#idempotency)

The SDK automatically sends an `Idempotency-Key` header on every `POST` and `PATCH` request.

```
$checkout = $vatly->checkouts->create([
    'products' => [
        ['id' => 'subscription_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' => 'subscription_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();
```

Webhooks
--------

[](#webhooks)

Verify and parse incoming Vatly webhooks with `Webhook::parse()`, which returns a typed `WebhookPayload`:

```
use Vatly\API\Webhooks\Webhook;

$event = Webhook::parse($rawBody, $signatureHeader, $webhookSecret);
```

For strongly-typed, per-event objects, this package also owns immutable event DTOs under `Vatly\API\Webhooks\Events\*` (e.g. `OrderPaid`, `RefundCompleted`, `SubscriptionStarted`). Money fields are `Vatly\API\Types\Money` (decimal-string + currency; call `$event->total->toCents()` / read `$event->total->currency` to flatten at your persistence edge) and the VAT breakdown is `Vatly\API\Types\TaxSummaryCollection`; order lines are `Vatly\API\Types\OrderLineData`. These are the canonical event shapes that higher-level integrations build on.

`Vatly\API\Webhooks\WebhookEventFactory` turns a verified payload into one of these typed events — verify, parse, and map all happen in api-php now. Pass it a `VatlyApiClient` and hand it the `WebhookReceived` from `fromPayload()`:

```
use Vatly\API\Webhooks\Webhook;
use Vatly\API\Webhooks\WebhookEventFactory;

$payload = Webhook::parse($rawBody, $signatureHeader, $webhookSecret);

$factory = new WebhookEventFactory($client);
$event = $factory->createFromWebhook($factory->fromPayload($payload));
// e.g. $event instanceof Vatly\API\Webhooks\Events\OrderPaid
```

Because Vatly sends fat, HMAC-signed payloads — the delivery's `object` is byte-identical to the corresponding `GET /…/{id}` body — the factory builds every event straight from the signed payload (hydrating the matching api-php resource in memory for money/tax-bearing events). It makes **no follow-up API call**. Use `getSupportedEvents()` / `isSupported()` to inspect the event surface.

The incoming webhook payloads are described in the `webhooks:` section of the [OpenAPI spec](https://docs.vatly.com/openapi.yaml). See [docs/Webhooks.md](docs/Webhooks.md) for the full guide.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Send in a Pull Request if you'd like to contribute to this package.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

In case of a security vulnerability, please shoot us an email at .

Credits
-------

[](#credits)

- [Vatly.com](https://www.vatly.com)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance76

Regular maintenance activity

Popularity25

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 73.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

22

Last Release

28d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/78913b3d9fc2c28cf333e08366566ac23d0894a14d4c0914365acfb208420c29?d=identicon)[sandervanhooft](/maintainers/sandervanhooft)

---

Top Contributors

[![sandervanhooft](https://avatars.githubusercontent.com/u/7265703?v=4)](https://github.com/sandervanhooft "sandervanhooft (34 commits)")[![ag84ark](https://avatars.githubusercontent.com/u/10678506?v=4)](https://github.com/ag84ark "ag84ark (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

morpaymentsphpsaassubscriptionsvatlyphpbillingpaymentspaypalidealcreditcardApple Payvatlyvatly-api-php

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vatly-vatly-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/vatly-vatly-api-php/health.svg)](https://phpackages.com/packages/vatly-vatly-api-php)
```

###  Alternatives

[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.0M84](/packages/mollie-mollie-api-php)[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.5M36](/packages/mollie-laravel-mollie)[mollie/magento2

Mollie Payment Module for Magento 2

1131.9M16](/packages/mollie-magento2)[aktive_merchant/aktive_merchant

Aktive-Merchant provides a common interface to process payments using multiple gateways.

14936.8k](/packages/aktive-merchant-aktive-merchant)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

261.8M1](/packages/mollie-oauth2-mollie-php)[mollie/magento

iDEAL, Creditcard, Bancontact/Mister Cash, SOFORT, Bank transfer, Bitcoin, PayPal &amp; paysafecard for Magento https://www.mollie.com/

407.9k](/packages/mollie-magento)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
