Open source
HyperSwitch PHP SDK
A pure-PHP client for the HyperSwitch payment orchestration API. Framework-agnostic, MIT-licensed, built by X2Y while working with a payment provider that asked us to look into HyperSwitch, and usable in any PHP project.
Last reviewed
What it covers
The whole public API, not the handful of calls one integration needed.
All 150 operations
Every operation in HyperSwitch's v1 OpenAPI spec: payments, refunds, customers, mandates, subscriptions, disputes, payouts, payment links, routing, 3-D Secure, connectors, merchant accounts and the rest, each through its own typed resource.
Webhooks you can trust
HyperSwitch signs every webhook. The SDK checks the signature before it parses a byte of the body, then decodes the event into a typed object; an event type it doesn't know yet still comes through, raw.
Every way to authenticate
Merchant API keys, publishable keys, admin keys, ephemeral keys, profile-scoped keys and bearer tokens, each where the API expects it.
Any PHP project
PHP 8.1 and up, with any PSR-18 HTTP client and PSR-3 logger. No framework, so it drops into Magento, Laravel, Symfony or plain PHP the same way.
Built to stay current
A payment API keeps changing. An SDK that can't tell when it has fallen behind quietly breaks the checkout it serves.
Pinned to the spec
The SDK is checked against a pinned copy of HyperSwitch's own OpenAPI spec. A drift test fails the build if the API has an operation the SDK lacks, or the SDK has one the API doesn't.
Strict by default
Typed requests and responses throughout, and static analysis with PHPStan at its strictest level on every change.
A short way to catch up
When HyperSwitch ships an API change: re-pin the spec, run the drift test, fill the gaps it lists, run the checks, tag a release. The steps are in the repository.
Why we built it
We build and maintain payment gateway modules. A payment provider we work with asked us to look into HyperSwitch, an open-source payment orchestration platform, and the module we built for it needed a client that covered the whole API and stayed in step with it. So we built one, told them from the start that it would be open source, and kept it free of anything Magento-specific so it can serve other platforms too.
It is MIT-licensed, copyright X2Y.io, Inc. Take it, use it, change it. See the gateway modules we build and maintain.
HyperSwitch SDK progress
How the SDK has grown, one post per milestone.
Building on HyperSwitch?
Tell us which platform and which providers, and we'll tell you what a module on top of this SDK involves.
Contact us