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 and Authorize.Net.
DETERMINISTIC BODIES¤IDEMPOTENT WRITES¤EXACT MINOR UNITS¤PORTS & ADAPTERS¤RAW REST · NO VENDOR SDKS¤FRAMEWORK-AGNOSTIC CORE¤DETERMINISTIC BODIES¤IDEMPOTENT WRITES¤EXACT MINOR UNITS¤PORTS & ADAPTERS¤RAW REST · NO VENDOR SDKS¤FRAMEWORK-AGNOSTIC CORE¤
01
Built like infrastructure, not a wrapper.
Domain-driven layers keep the business rules clean and the network at arm's length.
/01
Domain-driven layering
A pure Domain of contracts, commands, results, value objects and enums; a thin Application factory; and an Infrastructure layer for drivers & Laravel adapters. Dependencies point inward — the core never touches the framework.
/02
Factory + one interface
Resolve any gateway through PaymentGatewayFactory and program against a single PaymentGatewayInterface. Unsupported operations throw UnsupportedOperationException, so the surface is identical everywhere.
/03
Ports & adapters
The HttpClient and CredentialResolver ports live in the Domain; adapters live in Infrastructure. Ship the retrying Laravel transport in production, swap the in-memory fake in tests — bind only the port you want to replace.
/04
Raw REST, no vendor SDKs
Every driver speaks the gateway's REST API directly and signs its own requests — CyberSource HMAC HTTP-Signature, Fawry SHA-256, Paymob HMAC-SHA512, PayLink HMAC-SHA256, PayTabs server-key auth with HMAC-SHA256 callbacks, PayPal OAuth 2.0 client credentials, Mastercard MPGS HTTP Basic auth, Authorize.Net name/transaction-key auth. No heavy third-party gateway dependencies.
/05
Deterministic & idempotent
Request bodies are built without hidden uniqid()/time(), so identical inputs produce byte-for-byte identical requests. Every write carries an idempotency key routed to the gateway's native dedup — retries are safe.
/06
Exact money, strict types
Amounts are carried as minor units and never rounded. PHPStan runs at level max with a zero baseline, formatted with Pint, refactor-checked with Rector, and covered by 290+ database-free Pest tests.
/07
Events & listeners
Each driver emits a typed domain event after every operation — charge, capture, refund, void, vault, checkout, webhook. One listener on the PaymentEvent interface receives them all, or target a single event. Payloads are queue-safe: ids, amount and result — never the raw request or card data.
02
Eight gateways. One PaymentGatewayInterface.
Each driver extends AbstractPaymentGateway and implements the same fat contract.
CyberSourceHMAC 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.
FawrySHA-256
Hosted & reference
Start a hosted checkout — card, wallet, pay-at-Fawry, MyFawry or instalment — and redirect the payer or hand back a reference code.
PaymobHMAC-SHA512
Iframe flow
Runs the auth → order → payment-key handshake in one call and returns the iframe URL. Integration & iframe ids come from credentials or per-call options.
PayLinkHMAC-SHA256
Invoice link
Create an invoice, then redirect to the hosted checkout or embed it in an iframe, and reconcile later by invoice id. Supports settle, refund, void, reverse-authorization, and card tokenization — store a card in the TMS-backed vault, charge it as a stored credential, and revoke it.
PayTabsServer key
Every integration
Hosted page, emailable Invoice, reusable PayLink, iframe Managed Form, or an Own Form charge of a payment token. Saves card tokens for recurring / customer-initiated charges, starts repeat-billing agreements, splits settled funds across beneficiaries, and verifies the signed IPN callback.
PayPalOAuth 2.0
Orders v2 checkout
Create an order and redirect the buyer to approve it, then capture or authorize the approved order with charge. Captures, voids and refunds act on the payment resources; cards vault via the setup-token → payment-token flow for card-on-file charges, and webhooks verify through PayPal's signature API.
Mastercard MPGSHTTP Basic
Order & transaction
Initiate a Hosted Checkout session, then PAY or AUTHORIZE it against the merchant-assigned order and transaction ids. Captures, refunds, voids and reversals settle against the order; cards tokenize for stored-credential charges, 3-D Secure runs through the authentication operations, and webhooks verify with the notification secret.
Authorize.NetName / Transaction Key
Accept.js charge
Charge an Accept.js opaque-data token — the card is tokenised in the browser, so no PAN reaches your server — then capture, refund or void by transaction id. Vault the same token into a CIM profile for MIT/CIT stored-credential charges, look up a transaction for reconciliation, and verify the HMAC-SHA512 webhook signature.
03
The operation matrix.
What each driver supports. Anything unsupported throws — the surface never lies.
Operation
CyberSource UC
Fawry
Paymob
PayLink
PayTabs
PayPal
Mastercard MPGS
Authorize.Net
createCheckoutSession
capture context / orchestrated
hosted / card / wallet
iframe flow
invoice / iframe
hosted / invoice / paylink / managed
order → approval
hosted checkout
—
charge (transient token)
✓
—
—
—
Own Form
approved order
session
Accept.js
confirmOrchestratedPayment (verify result JWT)
RS256 · flx.jwk
—
—
—
—
—
—
—
capture
✓
Auth/Capture
✓
settle
✓
✓
✓
✓
refund
✓
✓
✓
✓
✓
✓
✓
✓
void
✓
cancel auth
✓
✓
✓
✓
✓
✓
reverseAuthorization
✓
—
—
✓
release
—
✓
—
enroll / validatePayerAuth (3-DS)
✓
—
—
—
—
—
✓
—
vault / chargeStoredCredential
TMS · MIT/CIT
—
—
vault · charge · revoke
token · MIT/CIT
vault · MIT/CIT
token · MIT/CIT
CIM · MIT/CIT
getTransaction / searchTransaction
✓
✓
✓
✓
query
order lookup
order lookup
transaction details
verifyWebhook
✓
✓
✓
✓
✓
API
secret
HMAC-SHA512
1 / 8tap a card to cycle
CyberSource UCHMAC HTTP-Signature
createCheckoutSession
capture context
charge
✓
confirmOrchestratedPayment
verify result JWT
capture
✓
refund
✓
void
✓
reverseAuthorization
✓
enroll / validatePayerAuth
✓
vault / chargeStoredCredential
TMS · MIT/CIT
getTransaction / searchTransaction
✓
verifyWebhook
✓
FawrySHA-256
createCheckoutSession
hosted / card / wallet
charge
—
capture
Auth/Capture
refund
✓
void
cancel auth
reverseAuthorization
—
enroll / validatePayerAuth
—
vault / chargeStoredCredential
—
getTransaction / searchTransaction
✓
verifyWebhook
✓
PaymobHMAC-SHA512
createCheckoutSession
iframe flow
charge
—
capture
✓
refund
✓
void
✓
reverseAuthorization
—
enroll / validatePayerAuth
—
vault / chargeStoredCredential
—
getTransaction / searchTransaction
✓
verifyWebhook
✓
PayLinkHMAC-SHA256
createCheckoutSession
invoice / iframe
charge
—
capture
settle
refund
✓
void
✓
reverseAuthorization
✓
enroll / validatePayerAuth
—
vault / chargeStoredCredential
vault · charge · revoke
getTransaction / searchTransaction
✓
verifyWebhook
✓
PayTabsServer key
createCheckoutSession
hosted / invoice / paylink / managed
charge
Own Form
capture
✓
refund
✓
void
✓
reverseAuthorization
release
enroll / validatePayerAuth
—
vault / chargeStoredCredential
token · MIT/CIT
getTransaction / searchTransaction
query
verifyWebhook
✓
PayPalOAuth 2.0
createCheckoutSession
order → approval
charge
approved order
capture
✓
refund
✓
void
✓
reverseAuthorization
—
enroll / validatePayerAuth
—
vault / chargeStoredCredential
vault · MIT/CIT
getTransaction / searchTransaction
order lookup
verifyWebhook
✓
Mastercard MPGSHTTP Basic
createCheckoutSession
hosted checkout
charge
session
capture
✓
refund
✓
void
✓
reverseAuthorization
✓
enroll / validatePayerAuth
✓
vault / chargeStoredCredential
token · MIT/CIT
getTransaction / searchTransaction
order lookup
verifyWebhook
secret
Authorize.NetName / Transaction Key
createCheckoutSession
—
charge
Accept.js
capture
✓
refund
✓
void
✓
reverseAuthorization
—
enroll / validatePayerAuth
—
vault / chargeStoredCredential
CIM · MIT/CIT
getTransaction / searchTransaction
transaction details
verifyWebhook
HMAC-SHA512
04
From zero to charged.
The provider auto-registers the factory and ports. Inject the factory — no service location, no new.
1 Install
# Composer auto-discovers the service provider
composer require hyprpay/payments
Retries are safe by construction: bodies are deterministic and every write carries an
idempotency key — routed to v-c-idempotency-key, merchantRefNum,
merchant_order_id, or an Idempotency-Key / PayPal-Request-Id
header, per gateway.
Program against one contract. Let the factory pick the driver.