Anypay is a comprehensive PHP,LARAVEL library for handling multiple payment gateway integrations seamlessly.

Maintainers

Package info

github.com/morpheusadam/anypay

pkg:composer/morpheusadam/anypay

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 7

Open Issues: 0

v1 2024-06-25 13:18 UTC

This package is auto-updated.

Last update: 2026-06-29 13:21:46 UTC


README

๐Ÿ’ณ Anypay โ€” Multi-Gateway PHP / Laravel Payment Library

A comprehensive PHP & Laravel payment library that connects 40+ payment gateways behind one unified API โ€” purchase, pay, and verify online transactions with a single, consistent interface.

License Stars Forks Last commit Repo size

PHP Laravel Composer 40+ gateways

๐Ÿ“– Overview

Anypay is a comprehensive PHP and Laravel payment library for handling multiple payment-gateway integrations through a single, unified API. Instead of learning a different SDK for every bank or gateway, you write your checkout flow once and switch providers by changing a driver name โ€” Anypay gives developers a simple, uniform payment experience with consistent purchase โ†’ pay โ†’ verify semantics across every gateway.

The package bundles 40+ drivers, covering the major Iranian bank and PSP gateways (Mellat, Melli/Sadad, Saman, Parsian, Pasargad, Saderat, Zarinpal, IDPay, Zibal and many more), popular wallet and installment (BNPL) providers (Azki, Etebarino, Walleta, Digipay, Vandar, Toman), and international gateways such as PayPal and Bitpay. It ships with Laravel auto-discovery (service provider + facade) and works equally well in plain PHP projects.

๐Ÿ”Ž Keywords: PHP payment gateway, Laravel payment library, multi-gateway payment, online payment integration, unified payment API, Iran payment gateway, Iranian bank integration, Zarinpal, Mellat, Saman, PayPal PHP, payment processing library, BNPL installment payment.

โœจ Features

  • ๐Ÿ”Œ 40+ payment gateways out of the box โ€” one driver-based interface for all of them.
  • ๐Ÿงฉ Unified API โ€” the same purchase(), pay(), and verify() flow regardless of gateway.
  • ๐Ÿ›Ÿ Robust error handling โ€” dedicated exceptions for invalid payments, failed purchases, and missing drivers/invoices.
  • โš™๏ธ Dynamic configuration โ€” pass settings inline or load them from a published config file.
  • ๐Ÿช Trackable payment events โ€” hook into each stage of the payment lifecycle.
  • ๐Ÿงฑ Laravel-ready โ€” auto-registered service provider and Anypay facade (also usable in plain PHP).
  • ๐Ÿ’ณ Cards, wallets & installments โ€” supports standard card gateways plus BNPL / installment providers.

๐Ÿฆ Supported Gateways

The following drivers are bundled under src/Drivers/:

Aqayepardakht Asanpardakht Atipay Azki (installment)
Behpardakht (Mellat) Bitpay Digipay Etebarino (installment)
Fanavacard Gooyapay IDPay Irankish
Jibit Local Minipay Nextpay
Omidpay Parsian Pasargad Payfa
Pay.ir PayPal Payping Paystar
Poolam Rayanpay Sadad (Melli) Saman
SEP (Saman Electronic) Sepehr (Saderat) Sepordeh Sizpay
Toman Vandar Walleta (installment) Yekpay
Zarinpal Zibal

๐Ÿ› ๏ธ Tech Stack

Component Technology
Language PHP โ‰ฅ 7.2
Framework Laravel (service provider + facade; works standalone too)
HTTP client Guzzle
Utilities Carbon (dates), Ramsey UUID, chillerlan/php-cache
Install Composer (PSR-4: Morpheusadam\Anypay\)

Tech stack

๐Ÿš€ Getting Started

Prerequisites

  • PHP 7.2+ and Composer

Installation

composer require morpheusadam/anypay

In Laravel, the service provider and Anypay facade are auto-discovered โ€” no manual registration required.

๐Ÿ“ฆ Usage

Create and pay an invoice

$config  = ['driver' => 'gatewayName', 'api_key' => 'your_api_key'];
$anypay  = new Morpheusadam\Anypay\Anypay($config);

$invoice = new Morpheusadam\Anypay\Invoice();
$invoice->amount(1000); // amount in Rials

$anypay->via('gatewayName')->purchase($invoice)->pay();

Quick pay with the payWith helper

$config  = ['api_key' => 'your_api_key'];
$gateway = 'gatewayName';
$amount  = 1000; // amount in Rials

try {
    $anypay   = new Morpheusadam\Anypay\Anypay($config);
    $response = $anypay->payWith($gateway, $amount, $config);
    echo $response->getContent(); // payment response details
} catch (Exception $e) {
    echo 'Payment error: ' . $e->getMessage();
}

Verify a payment (on the callback)

try {
    $anypay  = new Morpheusadam\Anypay\Anypay($config);
    $receipt = $anypay->verify();
    echo 'Payment confirmed. Transaction ID: ' . $receipt->getTransactionId();
} catch (Exception $e) {
    echo 'Verification error: ' . $e->getMessage();
}

Using the Laravel facade with a published config

use Morpheusadam\Anypay\Facades\Anypay;

$invoice = (new Invoice)->amount(1000);

Anypay::via('driverName')->purchase($invoice, function ($driver, $transactionId) {
    // store $transactionId against the order
});

๐Ÿค Contributing

Contributions are welcome! Open an issue or submit a pull request to add a gateway driver, fix a bug, or improve the docs.

๐Ÿ“œ License

Distributed under the MIT License. See the LICENSE file for full terms.

๐Ÿ‘ค Author โ€” Morpheus Adam

Web developer & cheerful hacker ยท PHP ยท Laravel ยท Go

GitHub Website Email

โญ If Anypay simplified your checkout, consider giving it a star! โญ