Omnipay
A framework agnostic, multi-gateway payment processing library for PHP 5.6+
Install / Use
/learn @thephpleague/OmnipayREADME
Omnipay
An easy to use, consistent payment processing library for PHP
Omnipay is a payment processing library for PHP. It has been designed based on ideas from Active Merchant, plus experience implementing dozens of gateways for [CI Merchant]. It has a clear and consistent API, is fully unit tested, and even comes with an example application to get you started.
Why use Omnipay instead of a gateway's official PHP package/example code?
- Because you can learn one API and use it in multiple projects using different payment gateways
- Because if you need to change payment gateways you won't need to rewrite your code
- Because most official PHP payment gateway libraries are a mess
- Because most payment gateways have exceptionally poor documentation
- Because you are writing a shopping cart and need to support multiple gateways
TL;DR
Just want to see some code?
use Omnipay\Omnipay;
$gateway = Omnipay::create('Stripe');
$gateway->setApiKey('abc123');
$formData = array('number' => '4242424242424242', 'expiryMonth' => '6', 'expiryYear' => '2030', 'cvv' => '123');
$response = $gateway->purchase(array('amount' => '10.00', 'currency' => 'USD', 'card' => $formData))->send();
if ($response->isRedirect()) {
// redirect to offsite payment gateway
$response->redirect();
} elseif ($response->isSuccessful()) {
// payment was successful: update database
print_r($response);
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
As you can see, Omnipay has a consistent, well thought out API. We try to abstract as much as possible the differences between the various payments gateways.
Package Layout
Omnipay is a collection of packages which all depend on the
omnipay/common package to provide
a consistent interface. There are no dependencies on official payment gateway PHP packages -
we prefer to work with the HTTP API directly. Under the hood, we use the popular and powerful
PHP-HTTP library to make HTTP requests.
A Guzzle adapter is required by default, when using league/omnipay.
New gateways can be created by cloning the layout of an existing package. When choosing a
name for your package, please don't use the omnipay vendor prefix, as this implies that
it is officially supported. You should use your own username as the vendor prefix, and prepend
omnipay- to the package name to make it clear that your package works with Omnipay.
For example, if your GitHub username was santa, and you were implementing the giftpay
payment library, a good name for your composer package would be santa/omnipay-giftpay.
Installation
Omnipay is installed via Composer.
For most uses, you will need to require league/omnipay and an individual gateway:
composer require league/omnipay:^3 omnipay/paypal
If you want to use your own HTTP Client instead of Guzzle (which is the default for league/omnipay),
you can require omnipay/common and any php-http/client-implementation (see PHP Http)
composer require league/common:^3 omnipay/paypal php-http/buzz-adapter
Upgrade from v2 to v3
If your gateway is supported for v3, you can require that version. Make sure you require league/omnipay or a separate Http Adapter.
If there is no version for v3 yet, please raise an issue or upgrade the gateways yourself and create a PR. See the Upgrade guide for omnipay/common
Note: The package name has been changed from
omnipay/omnipaytoleague/omnipayfor v3
Payment Gateways
All payment gateways must implement GatewayInterface, and will usually extend AbstractGateway for basic functionality.
The following gateways are available:
Gateway | 2.x | 3.x | Composer Package | Maintainer --- | --- | --- | --- | --- 2c2p | ✓ | ✓ | dilab/omnipay-2c2p | Xu Ding 2Checkout | ✓ | - | omnipay/2checkout | Omnipay 2Checkout Improved | ✓ | - | collizo4sky/omnipay-2checkout | Agbonghama Collins 99Bill | - | ✓ | x-class/omnipay-99bill | Laraveler Acapture (PayVision) | ✓ | - | qup/omnipay-acapture | Niels de Vries Adyen | - | ✓ | academe/omnipay-adyen | Jason Judge Affirm | ✓ | ✓ | eduardlleshi/omnipay-affirm | Eduard Lleshi Agms | ✓ | - | agmscode/omnipay-agms | Maanas Royy Alipay(Global) | ✓ | ✓ | lokielse/omnipay-global-alipay | Loki Else Alipay | ✓ | ✓ | lokielse/omnipay-alipay | Loki Else Allied Wallet | ✓ | - | delatbabel/omnipay-alliedwallet | Del Arca | - | ✓ | k3rnel/omnipay-arca | Poghos Boyajyan Authorize.Net | ✓ | ✓ | omnipay/authorizenet | Jason Judge Authorize.Net API | - | ✓ | academe/omnipay-authorizenetapi | Jason Judge Authorize.Net Recurring Billing | - | ✓ | cimpleo/omnipay-authorizenetrecurring | CimpleO Bankart | ✓ | ✓ | ampeco/omnipay-bankart | Ampeco Barclays ePDQ | ✓ | - | digitickets/omnipay-barclays-epdq | DigiTickets BlueOrange bank | - | ✓ | deh4eg/omnipay-blueorange | Denis Smolakov Beanstream | ✓ | - | lemonstand/omnipay-beanstream | LemonStand BitPay | ✓ | ✓ | hiqdev/omnipay-bitpay | HiQDev BKM Express | ✓ | - | yasinkuyu/omnipay-bkm | Yasin Kuyu BlueSnap | ✓ | - | vimeo/omnipay-bluesnap | Vimeo Braintree | ✓ | ✓ | omnipay/braintree | Omnipay Buckaroo | ✓ | - | omnipay/buckaroo | Omnipay CardGate | ✓ | - | cardgate/omnipay-cardgate | CardGate CardSave | ✓ | - | omnipay/cardsave | Omnipay CashBaBa | ✓ | ✓ | omnipay/cashbaba | Recursion Technologies Ltd Checkout.com | ✓ | - | fotografde/checkoutcom | fotograf.de CloudBanking | ✓ | - | cloudbanking/omnipay-cloudbanking | Cloudbanking Coinbase | ✓ | - | omnipay/coinbase | Omnipay CoinGate | ✓ | - | coingate/omnipay-coingate | CoinGate CoinPayments | ✓ | ✓ | InkedCurtis/omnipay-coinpayments | InkedCurtis Creditcall | ✓ | - | meebio/omnipay-creditcall | John Jablonski CSOB (GP WebPay) | ✓ | - | bileto/omnipay-csob | Cybersource | ✓ | ✓ | dioscouri/omnipay-cybersource | Dioscouri Design Cybersource SOAP | ✓ | - | dabsquared/omnipay-cybersource-soap | DABSquared DataCash | ✓ | - | digitickets/omnipay-datacash | DigiTickets Datatrans | ✓ | - | w-vision/datatrans | [Dominik
Related Skills
node-connect
334.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
334.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.2kCommit, push, and open a PR
