Laravel 10–13 · Payment SDK · v0.17.0 · MIT

One clean interface. Every payment gateway.

A self-contained, multi-gateway payment SDK for PHP. A factory resolves the right driver, a swappable HTTP transport does the talking, and one contract covers CyberSource Unified Checkout, Fawry, Paymob, PayLink, PayTabs, PayPal, Mastercard MPGS, Authorize.Net, Airwallex and Tamara.

Read the docs → Quick start
01

Built like infrastructure,
not a wrapper.

Domain-driven layers keep the business rules clean and the network at arm’s length. Here is what that buys you.

Domain + application + infrastructure

Dependencies point inward, always.

A pure domain of contracts and value objects; drivers and Laravel adapters at the edge.

Factory + one interface

Swap a driver without touching a call site.

Program against one contract. What a driver can’t do throws — it never silently no-ops.

Ports & adapters

Bind only the port you want to replace.

Ship the retrying Laravel transport in production, swap the in-memory fake in tests.

Raw REST + own signing

No vendor SDKs in your lockfile.

Every driver speaks the gateway’s REST API directly and signs its own requests.

Minor units + strict types

Money that never rounds.

Amounts stay in minor units end to end, under PHPStan level max with a zero baseline.

Idempotency + retries

A retried write never double-charges.

Every write carries a key routed to the gateway’s own dedup, so retries are safe.

Typed events + one listener

Every operation announces itself.

Charge, capture, refund, vault and webhook each emit a queue-safe typed event.

3-D Secure + charge

ECI rejections surface before you settle.

A resolved ECI that isn’t fully authenticated raises its own typed event.

Vault + MIT/CIT

Cards on file that stay chargeable.

Tokenize once, charge as a stored credential, and let Account Updater refresh expiries.

Microform + 3-D Secure

No PAN ever reaches your server.

Flex Microform hosts the card fields; you get back a transient token and an ECI.

Wallets + merchant decrypt

Apple Pay and Google Pay on one path.

chargeWallet takes tokenizedCard or fluidData and tags the payment solution.

BIN lookup + DCC

Price the card before you charge it.

Read the BIN’s offers, quote a conversion rate, and present installment plans.

Webhooks + signature verify

Callbacks you can trust, typed on arrival.

Verify per driver, then handle one PaymentEvent instead of ten payload shapes.

Money transfer

Pull from one card, push to another.

Fund with an AFT, credit with an OCT, and declare the purpose the networks price it by.

Reporting + reconcile

Settlement that matches your ledger.

Pull a report, reconcile by order reference, and search when a reference goes missing.

Split payout + recurring

Marketplace money movement.

PayTabs splits settled funds across beneficiaries and auto-bills your agreement.

02

Ten gateways.
One PaymentGatewayInterface.

Each driver extends AbstractPaymentGateway and implements the same fat contract.

CyberSource UC HMAC HTTP-Signature

Unified Checkout

Mint a capture context for the widget, charge the transient token or run the orchestrated flow and verify the signed result JWT, run 3-DS payer-auth, and vault instruments for MIT/CIT stored credentials.

capture context charge orchestrated confirm 3-DS TMS vault
Read the actions
cyber.php
$request = new CheckoutSessionRequest(
    money: Money::minor(10000, 'EGP'),
    targetOrigins: ['https://shop.test'],
    orderReference: 'ORDER-123',
    enable3ds: true,
);

$session = $gateway->createCheckoutSession($request);

// mount the widget with $session->jwt
PayTabs Server key

Every integration

Hosted page, emailable Invoice, reusable PayLink, iframe Managed Form, or an Own Form charge of a payment token. Saves tokens for recurring charges, splits settled funds across beneficiaries, and verifies the signed IPN callback.

hosted invoice paylink managed own form tokens recurring split
Read the actions
paytabs.php
$request = new CheckoutSessionRequest(
    money: Money::minor(12030, 'SAR'),
    orderReference: 'ORDER-127',
    paymentMethod: 'invoice',
    options: new PaytabsCheckoutOptions(tokenise: 2),
);

$session = $gateway->createCheckoutSession($request);

// $session->reference is the tran_ref
PayPal OAuth 2.0

Orders v2 checkout

Create an order and redirect the buyer to approve it, then capture or authorize the approved order. Cards vault through the setup-token → payment-token flow, reconciliation runs on Transaction Search, and webhooks verify through PayPal.

order approval redirect capture authorize reverse vault MIT/CIT reporting
Read the actions
paypal.php
$request = new CheckoutSessionRequest(
    money: Money::minor(10000, 'USD'),
    orderReference: 'ORDER-128',
    returnUrl: 'https://shop.test/return',
    paymentMethod: 'authorize',
);

$session = $gateway->createCheckoutSession($request);

// redirect to $session->redirectUrl
03

The operation matrix.

What each driver supports. Anything unsupported throws — the surface never lies.

CyberSource UC Fawry Paymob PayLink PayTabs PayPal Mastercard MPGS Authorize.Net Airwallex Tamara
createCheckoutSession
CyberSource Fawry Paymob PayLink PayTabs PayPal MPGS Auth.Net — not implemented Airwallex Tamara
requestDccRateDynamic Currency Conversion
CyberSource Fawry — not implemented Paymob — not implemented PayLink — not implemented PayTabs — not implemented PayPal — not implemented MPGS Auth.Net — not implemented Airwallex — not implemented Tamara — not implemented
chargetransient token
CyberSource Fawry — not implemented Paymob — not implemented PayLink — not implemented PayTabs PayPal MPGS Auth.Net Airwallex Tamara — not implemented
chargeWalletApple Pay / Google Pay
CyberSource Fawry — not implemented Paymob — not implemented PayLink — not implemented PayTabs — not implemented PayPal — not implemented MPGS Auth.Net — not implemented Airwallex — not implemented Tamara — not implemented
confirmOrchestratedPaymentverify result JWT
CyberSource Fawry — not implemented Paymob — not implemented PayLink — not implemented PayTabs — not implemented PayPal — not implemented MPGS — not implemented Auth.Net — not implemented Airwallex — not implemented Tamara — not implemented
createMicroformSessionFlex Microform card fields
CyberSource Fawry — not implemented Paymob — not implemented PayLink — not implemented PayTabs — not implemented PayPal — not implemented MPGS — not implemented Auth.Net — not implemented Airwallex — not implemented Tamara — not implemented
capture
CyberSource Fawry Paymob PayLink PayTabs PayPal MPGS Auth.Net Airwallex Tamara
refund
CyberSource Fawry Paymob PayLink PayTabs PayPal MPGS Auth.Net Airwallex Tamara
void
CyberSource Fawry Paymob PayLink PayTabs PayPal MPGS Auth.Net Airwallex Tamara
reverseAuthorization
CyberSource Fawry — not implemented Paymob — not implemented PayLink PayTabs PayPal MPGS Auth.Net — not implemented Airwallex Tamara
setupPayerAuth3-DS device data collection
CyberSource Fawry — not implemented Paymob — not implemented PayLink — not implemented PayTabs — not implemented PayPal — not implemented MPGS — not implemented Auth.Net — not implemented Airwallex — not implemented Tamara — not implemented
enroll / validatePayerAuth3-DS
CyberSource Fawry — not implemented Paymob — not implemented PayLink — not implemented PayTabs — not implemented PayPal — not implemented MPGS Auth.Net — not implemented Airwallex — not implemented Tamara — not implemented
vault / chargeStoredCredential
CyberSource Fawry — not implemented Paymob — not implemented PayLink PayTabs PayPal MPGS Auth.Net Airwallex Tamara — not implemented
getTransaction / searchTransaction+ full history
CyberSource Fawry Paymob PayLink PayTabs PayPal MPGS Auth.Net Airwallex Tamara
pushFunds / pullFundsOCT + AFT money transfer
CyberSource Fawry — not implemented Paymob — not implemented PayLink — not implemented PayTabs — not implemented PayPal — not implemented MPGS — not implemented Auth.Net — not implemented Airwallex — not implemented Tamara — not implemented
verifyWebhook
CyberSource Fawry Paymob PayLink PayTabs PayPal MPGS Auth.Net Airwallex Tamara
04

From zero to charged.

The provider auto-registers the factory and ports. Inject the factory — no service location, no new.

  1. 1 Install

    # Composer auto-discovers the service provider
    composer require hyprpay/payments
  2. 2 Configure (optional)

    php artisan vendor:publish --tag=gateway-config
  3. 3 Bind your ports

    $this->app->bind(HttpClient::class, MyHttpClient::class);
    $this->app->bind(CredentialResolver::class, MyCredentialResolver::class);

    External services are fully decoupled. CredentialResolver seamlessly resolves single-tenant static configs and multi-tenant per-tenant credentials.

  4. 4 Charge

    $gateway = $this->gateways->make(GatewayName::Fawry);
    $gateway->charge($request);

    One charge() call works across every gateway. The factory resolves the driver, so you program against one contract.

Read the docs
app/Actions/ChargeInvoice.php
use Hyprpay\Payments\Domain\Command\ChargeRequest;
use Hyprpay\Payments\Domain\ValueObject\Money;
use Hyprpay\Payments\Domain\Enum\GatewayName;
use Hyprpay\Payments\Application\PaymentGatewayFactory;

final readonly class ChargeInvoice
{
    // Type-hint the factory; Laravel injects it.
    public function __construct(
        private PaymentGatewayFactory $gateways,
    ) {}

    public function handle(string $tokenFromWidget): void
    {
        $gateway = $this->gateways->make(
            GatewayName::CybersourceUnifiedCheckout,
        );

        $result = $gateway->charge(new ChargeRequest(
            transientToken: $tokenFromWidget,
            money: Money::minor(10000, 'EGP'), // 100.00, exact
            orderReference: 'ORDER-123',     // = idempotency key
        ));

        if ($result->success) {
            // $result->status, ->transactionId, ->raw
        }
    }
}

Retries are safe by construction: bodies are deterministic and every write carries an idempotency key — routed to v-c-idempotency-id, merchantRefNum, merchant_order_id, or an Idempotency-Key / PayPal-Request-Id header, per gateway.

Program against one contract.
Let the factory pick the driver.

Requires PHP ^8.2 · illuminate/support & illuminate/http ^10 | ^11 | ^12 | ^13 · firebase/php-jwt ^6.10 | ^7.0

What's new