Search by

elbanbydev / paykit

elbanbydev

Paykit - a clean, framework-native Laravel package for payment gateways: Paymob, Kashier, Fawry, Geidea, MyFatoorah, Tap, HyperPay, Checkout.com, PayPal, Stripe, Paystack, Moyasar, Razorpay, Mercado Pago, Mollie, Adyen, Flutterwave, PayTabs, Klarna, Square, Xendit, Telr, Viva.com, PayU, Tabby, Tamar

Package info

github.com/elbanbydev/paykit

pkg:composer/elbanbydev/paykit

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0


README

CI Packagist License: MIT

A small, honest Laravel package for payment gateways, wherever they are.

بالعربي: docs/ar/README.md · البداية السريعة

New here? Start with the quickstart.

Paykit gives you one clean API for starting a payment, verifying the gateway's callback, and getting a normalised result. Twenty-seven drivers so far: Paymob (Intention API + Unified Checkout), Kashier (v3 payment sessions), Fawry (pay-at-outlet reference numbers), Geidea (checkout sessions on the hosted page), MyFatoorah (invoice payment links + signed webhook v2), Tap (hosted charges + hashstring webhooks), HyperPay (COPYandPAY widget + AES-256-GCM encrypted webhooks), Checkout.com (Hosted Payments Page + Cko-Signature webhooks), PayPal (Orders v2 + verify-webhook-signature), Stripe (Checkout Sessions + the documented Stripe-Signature HMAC), Paystack (hosted checkout for Nigeria, Ghana, South Africa and Kenya + two documented webhook schemes) Moyasar (Saudi cards, mada, Apple/Samsung Pay and STC Pay over one API + shared-token webhooks) Razorpay (hosted Payment Links for India + HMAC-SHA-256 everything), Mercado Pago (Checkout Pro hosted pages for Latin America + manifest-signed notifications) and Mollie (hosted checkout for Europe - iDEAL, Bancontact, SEPA, Klarna, cards and more + deliberately unsigned webhooks verified by fetch) and Adyen (hosted Checkout sessions for global enterprise + HMAC-signed Standard webhooks) Flutterwave (hosted checkout across Africa + verif-hash webhooks re-checked through the API) and PayTabs (hosted payment pages across the Gulf + raw-body Signature callbacks) Klarna (hosted payment pages for Europe and the US + one-time-token callbacks re-checked through the API, with the documented place-order step) Square (hosted payment links + notifications signed over the notification URL and raw body) Xendit (hosted Payment Sessions across South-East Asia + x-callback-token webhooks) Telr (hosted payment pages across the Gulf + SHA1-signed transaction advice) Viva.com (Smart Checkout across Europe + HMAC-signed webhooks) PayU (the European PayU platform + MD5-signed notifications) Tabby (BNPL checkout across the UAE and Saudi Arabia + capture, refunds and header-authenticated webhooks) and Tamara (BNPL across Saudi Arabia and the Gulf + JWT-authenticated notifications, with the documented authorise step). Another, manual, covers what no wallet publishes an API for: a transfer to your Vodafone Cash number or InstaPay handle, confirmed by a human in a small approval panel. The Gulf drivers, PayPal, Stripe, Paystack, Moyasar, Razorpay, Mercado Pago, Mollie, Adyen, Flutterwave, PayTabs, Klarna, Square, Xendit, Telr, Viva.com, PayU, Tabby and Tamara are fixture-tested only, no live account has run them yet.

Status: v0.4.0, experimental. Do not take real money through it yet.

What was run against a real provider test mode: Kashier (hosted checkout, redirect signature, and a refund) and Paymob (creating a payment session, and the HMAC of the real signed redirect). That is all. A successful Paymob payment, Paymob refund/void/capture, and any real webhook delivery were not reached (Paymob's fresh test merchant declined every test card).

Geidea and Fawry are fixture-tested only: their code follows the published docs and recorded payloads, and was never run against the real service, because neither offers a test account without a human at the provider. The manual driver (Vodafone Cash, InstaPay) is exercised by the test suite only. Saved cards are not implemented anywhere.

Details and exact results: docs/sandboxes.md. Also read What is not supported yet.

Supported gateways

Gateway Start a payment Webhook verification Refund / void Capture Notes
Paymob Paykit::gateway('paymob') - Intention API, Unified Checkout HMAC-SHA512 over Paymob's 20 signed fields refund and void card authorizations Card, wallet and any other method you enable as an integration ID
Kashier Paykit::gateway('kashier') - v3 payment sessions HMAC-SHA256 in x-kashier-signature refund and void not documented Hosted page; card and wallet
Fawry Paykit::gateway('fawry') - charge API, pay-at-outlet reference number SHA-256 messageSignature, Notification V2 refund; void cancels an unpaid order not documented Reference numbers only; card and wallet are not implemented
Geidea Paykit::gateway('geidea') - create session + hosted checkout HMAC-SHA256 over the returned order refund only not documented Hosted page; the methods your Geidea account enables
MyFatoorah Paykit::gateway('myfatoorah') - SendPayment invoice links HMAC-SHA256 (base64) in myfatoorah-signature, webhook v2 refund request, completed by MyFatoorah's finance team not documented Kuwait, Saudi Arabia and the Gulf; fixture-tested only, no live run yet
Tap Paykit::gateway('tap') - Charges API, hosted page (src_all) HMAC-SHA256 (hex) in hashstring, amount formatted to the currency's ISO scale refund, amount required not documented Saudi Arabia, Kuwait, UAE and the Gulf; fixture-tested only, no live run yet
HyperPay Paykit::gateway('hyperpay') - server-to-server checkout + payment widget AES-256-GCM encrypted body; the GCM tag is the signature refund, amount required not documented Saudi Arabia and the Gulf; mada, cards; fixture-tested only, no live run yet
Checkout.com Paykit::gateway('checkoutcom') - Hosted Payments Page HMAC-SHA256 (hex) over the raw body in Cko-Signature refund accepted async (202), completed by the payment_refunded webhook not documented MENA and worldwide; fixture-tested only, no live run yet
PayPal Paykit::gateway('paypal') - Orders v2, approve-link redirect PayPal's own verify-webhook-signature endpoint decides refund, full or partial, addressed by the capture id required second call after approval, full amount only International; no EGP support; fixture-tested only, no live run yet
Stripe Paykit::gateway('stripe') - hosted Checkout Sessions HMAC-SHA256 of {t}.{raw body} in Stripe-Signature, constant-time, 5-minute replay tolerance refund, full or partial, addressed by the payment intent id not implemented International; no merchant accounts in Egypt or most of the Gulf; fixture-tested only, no live run yet
Paystack Paykit::gateway('paystack') - hosted checkout page two documented schemes: Paystack-Signature (HMAC-SHA-512 of {t}.{raw body}, whsec_ secret, 300s replay tolerance) and legacy x-paystack-signature (HMAC-SHA-512 of the raw body under the secret key) refund queued async, pending until the refund.processed webhook server-side verifyTransactionStatus() after the redirect Nigeria, Ghana, South Africa, Kenya; NGN/GHS/ZAR/KES/USD; fixture-tested only, no live run yet
Moyasar Paykit::gateway('moyasar') - API payment + 3DS challenge redirect no signature: the webhook echoes the shared secret token you registered, compared in constant time refund synchronous, the response already says refunded server-side fetchPaymentStatus() after the callback Saudi Arabia / Gulf; SAR-first, mada + cards + STC Pay + SADAD; fixture-tested only, no live run yet
Razorpay Paykit::gateway('razorpay') - hosted Payment Links HMAC-SHA-256 of the raw body in X-Razorpay-Signature (webhook secret), constant-time; the browser callback has its own documented signature, verifyCallbackSignature() refund pending until refund.processed; documented X-Refund-Idempotency header sent server-side fetchPaymentStatus() after the callback India (+ Malaysia/Singapore/US on the API); INR-first; fixture-tested only, no live run yet
Mercado Pago Paykit::gateway('mercadopago') - Checkout Pro hosted pages HMAC-SHA-256 of the documented manifest id:{data.id};request-id:{x-request-id};ts:{ts}; in x-signature, constant-time, 300s tolerance; the notification is a signal, the driver fetches the payment for the truth refund, full (empty body) or partial, in MAJOR units; documented X-Idempotency-Key sent server-side fetchPaymentStatus() after the return Latin America (AR/BR/MX/CL/CO/PE/UY); fixture-tested only, no live run yet
Mollie Paykit::gateway('mollie') - hosted checkout page deliberately unsigned: the webhook carries only the payment id, and the documented security model is the authenticated fetch that follows - a fake call can never mark anything paid refund, full or partial; the amount object is required on every refund server-side fetchPaymentStatus() after the return Europe; EUR-first, iDEAL/Bancontact/SEPA/Klarna/cards and more; fixture-tested only, no live run yet
Adyen Paykit::gateway('adyen') - hosted Checkout sessions HMAC-SHA-256 of the documented colon-joined payload, keyed by the hex-decoded HMAC key, base64 in additionalData.hmacSignature; every item verified before any is parsed refund async: acknowledged, pending until the REFUND webhook; amount required none: Adyen settles status by webhook Global enterprise; MINOR units; fixture-tested only, no live run yet
Flutterwave Paykit::gateway('flutterwave') - hosted checkout link (POST /v3/payments) no HMAC: the dashboard's secret hash comes back verbatim in verif-hash, compared in constant time, and then the documented GET /v3/transactions/{id}/verify decides the truth - a forged call cannot mark anything paid refund, full (no amount) or partial, in MAJOR units; completed means initiated, only completed-* is finished server-side fetchPaymentStatus() after the return Nigeria, Ghana, Kenya, South Africa and more of Africa; MAJOR units; fixture-tested only, no live run yet
PayTabs Paykit::gateway('paytabs') - hosted payment page (POST /payment/request) hex HMAC-SHA-256 of the whole raw callback body under the profile's Server Key, in a Signature header, constant-time; the documented status set is closed, so an unknown code is refused rather than guessed refund, amount required, addressed by the original tran_ref; P is a manual refund still pending server-side fetchPaymentStatus() via POST /payment/query Saudi Arabia, UAE, Egypt, Oman, Jordan, Kuwait, Qatar, Morocco, Iraq; MAJOR units; fixture-tested only, no live run yet
Klarna Paykit::gateway('klarna') - payment session + hosted page (POST /payments/v1/sessions, then POST /hpp/v1/sessions) no HMAC: the documented one-time token in the status_update URL is compared in constant time, then the session is re-read through the API, so a forged call can never mark anything paid refund, amount required, addressed by Klarna's own order id; there is no full-refund default placeOrder() after the customer authorises: an authorization is not money Europe and the US; BNPL and pay-now; MINOR units; fixture-tested only, no live run yet
Square Paykit::gateway('square') - Square-hosted payment link (POST /v2/online-checkout/payment-links) HMAC-SHA-256, base64, of the notification URL followed by the raw body, keyed by the subscription's signature key, in x-square-hmacsha256-signature, constant-time; the notification is the signal, the authenticated payment read is the truth refund, amount required, addressed by the Square payment id; PENDING until Square approves it server-side fetchPaymentStatus(); an APPROVED payment is authorised, not captured, and comes through pending US, Canada, UK, Ireland, Australia, Japan, France, Spain; MINOR units; fixture-tested only, no live run yet
Xendit Paykit::gateway('xendit') - Payment Session in PAYMENT_LINK mode (POST /sessions) no HMAC: the dashboard's callback token comes back verbatim in x-callback-token, compared in constant time, and the documented session status set is closed, so an unknown status is refused rather than guessed refund, amount required, addressed by Xendit's payment_id; PENDING until the refund webhook settles it none: the callback token is the documented authentication Indonesia, the Philippines, Malaysia, Thailand, Vietnam, Singapore; smallest-unit amounts; fixture-tested only, no live run yet
Telr Paykit::gateway('telr') - hosted payment page (POST /gateway/order.json, method create) SHA1 of the secret key followed by the documented transaction fields, colon-joined, in tran_check, constant-time; percent-encoded values decoded first, a missing field contributing an empty value, exactly as the docs say not wrapped: Telr documents refunds on a different product surface, so the driver does not claim them server-side fetchPaymentStatus() through the documented check method UAE, Saudi Arabia and the wider Gulf; MAJOR-unit decimal strings; H (authorised, on hold) is pending, not paid; fixture-tested only, no live run yet
Viva.com Paykit::gateway('viva') - Smart Checkout payment order (POST /checkout/v2/orders) hex HMAC-SHA-256 of the raw body in Viva-Signature-256, with the documented SHA-1 Viva-Signature as a fallback, constant-time; the event id and the transaction's own StatusId have to agree or the notification is refused not wrapped: Viva documents refunds on a separate product surface, so the driver does not claim them none: Viva's docs say to confirm with OrderCode plus TransactionId, StatusId and Amount, which the driver checks Europe (Viva.com is a Greek acquirer with a wide European footprint); MINOR units; F is finished, A/C are pending, R is refunded; fixture-tested only, no live run yet
PayU Paykit::gateway('payu') - PayU Global order + redirect (POST /api/v2_1/orders) MD5 of the raw body concatenated with the POS's second key, in OpenPayu-Signature, constant-time; an algorithm the driver has not been grounded in is refused rather than approximated full (no amount) or partial, lowest-currency-unit amount, addressed by PayU's order id; anything PayU does not spell out stays pending none: the signed notification is the state Europe (PayU Global, secure.payu.com - not PayU India); lowest-unit amounts as strings; PENDING and WAITING_FOR_CONFIRMATION are pending, only COMPLETED is paid; fixture-tested only, no live run yet
Tabby Paykit::gateway('tabby') - hosted checkout session (POST /api/v2/checkout) Tabby has no body signature: you register a custom header with your own secret and the driver compares it in constant time, as Tabby's docs prescribe full or partial, amount required (Tabby has no amount-less full refund), addressed by Tabby's payment id POST /api/v2/payments/{id}/captures; only a captured payment is CLOSED and settles UAE and Saudi Arabia (region-pinned base URL: api.tabby.ai / api.tabby.sa); DECIMAL string amounts in AED or SAR; AUTHORIZED is pending, only CLOSED is paid; fixture-tested only, no live run yet
Tamara Paykit::gateway('tamara') - hosted checkout session (POST /checkout) an HS256 JWT signed with your notification token, arriving both as Authorization: Bearer and as the tamaraToken query parameter; the driver verifies the signature itself, checks the expiry, and refuses any algorithm other than HS256 full or partial, amount required, addressed by Tamara's order_id not wrapped: Tamara's capture is a documented call that wants the order's items back, so authorise() is the step this driver implements Saudi Arabia, UAE, Bahrain, Kuwait, Oman; MAJOR-unit amounts in {amount, currency}; approved is pending and authorised is paid; authorise() is the documented step after the approved notification; fixture-tested only, no live run yet
Manual (Vodafone Cash, InstaPay) Paykit::gateway('manual') - a reference, a transfer to your wallet, a human decision none: a human confirms in the panel not applicable not applicable No merchant API to call; the panel stays closed until you name a Gate ability
Wallets, BNPL, Meeza, InstaPay through Paymob, Kashier or Geidea methods - - - None publishes a merchant API of its own; see Wallets, BNPL, Meeza and InstaPay

Coming from Tahseel

Paykit was called Tahseel (elbanbydev/tahseel) up to 0.4.x. Switching means a new composer package, the Paykit\ namespace, config/paykit.php, PAYKIT_* env vars, paykit:* artisan commands, and webhook URLs under /paykit/webhooks/{gateway} (set PAYKIT_WEBHOOKS_PATH=tahseel/webhooks/{gateway} to keep the old URLs). The manual-transfer tables are renamed in place by php artisan migrate. The step-by-step list is in the 0.5.0 CHANGELOG entry.

Why

Most payment-gateway integrations are copy-pasted snippets: an intention call here, an HMAC check there, and a callback handler that trusts whatever arrives. Paykit keeps the pieces separate and testable:

  • One request object, one session object. Amounts are integers in piastres, never floats.
  • Signature verification is not optional. A callback is parsed only after its HMAC matches, compared in constant time.
  • Replays are dropped, and so are late ones. The same transaction is handled once, and a callback older than one already handled for the same order cannot move the order back.
  • Idempotency is built in. Retrying a create-payment call with the same key returns the same intention instead of charging twice.
  • Recorded-fixture tests. Every driver is tested against recorded gateway responses and callbacks, with no network access.

Requirements

  • PHP 8.2 or newer
  • Laravel 12, tested on PHP 8.2, 8.3 and 8.4 in CI. The package constrains illuminate/* to ^11.0 || ^12.0, so it installs on Laravel 11 as well, but upstream security fixes for Laravel 11 have ended and CI does not cover it.

Installation

Paykit is not on Packagist yet. Add the repository, then require it:

{
    "repositories": [
        { "type": "vcs", "url": "https://github.com/elbanbydev/paykit" }
    ]
}
composer require elbanbydev/paykit:dev-main

Publish the config file:

php artisan vendor:publish --tag=paykit-config

Configuration

PAYKIT_GATEWAY=paymob

PAYMOB_BASE_URL=https://accept.paymob.com
PAYMOB_CHECKOUT_URL=https://eg.checkout.paymob.com/
PAYMOB_SECRET_KEY=sk_test_...
PAYMOB_PUBLIC_KEY=pk_test_...
PAYMOB_HMAC_SECRET=...
PAYMOB_INTEGRATION_IDS=5123456
PAYMOB_API_KEY=                      # optional, only for refund, void and capture
PAYMOB_NOTIFICATION_URL=https://your-app.test/paykit/webhooks/paymob
PAYMOB_REDIRECTION_URL=https://your-app.test/checkout/done
Key What it is
secret_key Dashboard → Settings → API Keys. Sent server-side as Authorization: Token sk_....
public_key Safe for the browser. Used to build the checkout URL.
hmac_secret Verifies every callback. Without it Paykit refuses to parse webhooks.
integration_ids One ID per payment method you enabled, comma separated. Test IDs must match a test secret key.
api_key Optional. Lets Paykit mint the short-lived auth_token that the acceptance refund, void and capture calls also accept in the body.
base_url accept.paymob.com (Egypt), uae.paymob.com, ksa.paymob.com, oman.paymob.com.
checkout_url Regional Unified Checkout host, e.g. https://eg.checkout.paymob.com/.

The secret key, public key and HMAC secret belong on the server. Only the public key is safe to expose.

Check the configuration before the first payment

php artisan paykit:check

It prints one row per driver: ok, missing with the key and the env variable to set, or not configured for a driver you never filled in. A driver with no keys at all does not fail the command; the default gateway always has to be complete. It also prints whether the webhook route is enabled and at which path.

Proving your keys work

paykit:check reads your configuration; it cannot tell whether the keys are valid. This starts one real payment through the driver:

php artisan paykit:smoke
php artisan paykit:smoke --gateway=kashier --amount=1.00 --method=card

It prints the endpoint, the reference, the session and order ids, the checkout URL (or Fawry's reference number) and where the callback should land. Nothing is charged: every driver Paykit ships only reserves a payment page or a reference number at this step. The amount defaults to 1.00 in the driver currency.

If the gateway rejects the request, the command exits non-zero and prints the gateway's own message, which is usually the useful one ("Invalid API key", "merchant not enabled for wallets"). When the endpoint is not obviously a test host it warns first, because Paymob serves test and live accounts from the same host: the keys decide, not the URL.

Pay that session with a test card and watch the callback arrive at /paykit/webhooks/{gateway} to prove the whole loop, signature check included.

Starting a payment

The examples below use Paymob. Every driver takes the same PaymentRequest; only the gateway name changes.

use Paykit\Data\Customer;
use Paykit\Data\LineItem;
use Paykit\Data\Money;
use Paykit\Data\PaymentRequest;
use Paykit\Facades\Paykit;

$session = Paykit::createPayment(new PaymentRequest(
    reference: 'ORDER-1042',                       // comes back as merchant_order_id
    amount: Money::of('250.00', 'EGP'),            // stored as 25000 piastres
    customer: new Customer(
        firstName: 'Ahmed',
        lastName: 'Elbanby',
        phone: '+201070645696',
        email: 'ahmed@example.com',
        city: 'Zagazig',
    ),
    items: [new LineItem('Pro plan', Money::of('250.00'))],
    extras: ['customer_id' => '42'],
    idempotencyKey: 'order-1042-attempt-1',
));

return redirect()->away($session->checkoutUrl);

PaymentSession carries intentionId, orderId, clientSecret, checkoutUrl and the untouched gateway raw response. Store the reference and the order ID; that is what the callback gives back.

If you retry with the same idempotencyKey, you get the same session back and Paymob is not called again. Keys are kept for paykit.idempotency.ttl seconds (one day by default).

When the gateway does not answer

A timeout or a dropped connection is not a failed payment, it is an unknown one. Paykit turns it into a GatewayException whose message says so:

paymob create intention did not get an answer from the gateway (cURL error 28: ...).
The request may or may not have been processed: check the gateway dashboard before retrying.

Retrying a create-payment call with the same idempotencyKey is safe: the stored session comes back and the gateway is not called again. Retrying a refund is not safe, because the first attempt may already have moved the money. Paykit never retries by itself.

Amounts

Money holds the smallest currency unit. Money::of('250.00') and Money::minor(25000) are the same amount. Prices are parsed as strings, so 0.1 + 0.2 never turns into 29 piastres by accident.

Receiving the callback

Paykit registers POST /paykit/webhooks/{gateway} (change it with paykit.webhooks.path). Point Paymob's notification_url at /paykit/webhooks/paymob.

The controller:

  1. Recomputes the HMAC-SHA512 over the 20 signed fields, in Paymob's documented order, and compares it in constant time.
  2. Returns 401 if the signature is missing or wrong, 400 if the payload is not a TRANSACTION callback, 200 with {"status":"duplicate"} if the transaction was already handled, 200 with {"status":"stale"} if the callback is older than one already handled for the same order.
  3. Dispatches WebhookReceived and then one of the payment events.
use Illuminate\Support\Facades\Event;
use Paykit\Events\PaymentSucceeded;

Event::listen(function (PaymentSucceeded $event) {
    $event->event->reference;        // 'ORDER-1042'
    $event->event->amount->minor;    // 25000
    $event->event->transactionId;    // Paymob transaction id
    $event->event->status;           // Paykit\Enums\PaymentStatus
});
Event When
WebhookReceived Every verified callback, before the specific event.
PaymentSucceeded success: true, not pending, not refunded, not voided.
PaymentPending pending: true.
PaymentFailed success: false.
PaymentRefunded is_refunded: true.
PaymentVoided is_voided: true.

Duplicates and out-of-order callbacks

Gateways retry. Paymob retries a callback until it gets a 200, Kashier and Fawry do the same, so the same transaction will reach you more than once. Paykit handles that before any event fires:

  • Duplicate - the same transaction (or, when the callback carries no transaction id, the same payload) is only dispatched once. The repeat gets {"status":"duplicate"}. Keys are kept for paykit.webhooks.dedupe_ttl seconds (two days by default).
  • Out of order - a callback whose timestamp is older than one already handled for the same order is dropped with {"status":"stale"}. A retried PENDING landing after the SUCCEEDED will not move the order back. A callback with no readable timestamp is never treated as stale.

Both need a shared cache when you run more than one server. Point them at one store:

'webhooks' => [
    'deduplicate' => env('PAYKIT_WEBHOOKS_DEDUPLICATE', true),
    'ordering' => env('PAYKIT_WEBHOOKS_ORDERING', true),
    'store' => env('PAYKIT_WEBHOOKS_STORE'),   // null = the app's default cache store
    'dedupe_ttl' => (int) env('PAYKIT_WEBHOOKS_DEDUPE_TTL', 172800),
],

Turn either check off if your own code already reconciles order state. Returning 200 to a dropped callback is deliberate: a non-2xx makes the gateway retry a callback Paykit will drop again.

Never trust the redirect

redirection_url is a convenience for the shopper's browser. It is not signed and anyone can open it. Order state changes only from the verified webhook.

If your webhook route lives in the api group

Add the middleware in config/paykit.php:

'webhooks' => [
    'middleware' => ['api'],
],

Refunds and voids

Refunds, voids and captures are their own contracts, SupportsRefunds, SupportsVoids and SupportsCapture, so a driver only claims what its gateway really documents.

use Paykit\Data\Money;
use Paykit\Data\RefundRequest;
use Paykit\Data\VoidRequest;
use Paykit\Facades\Paykit;

// Full refund of a Paymob transaction. The id comes from the callback.
$result = Paykit::refund(RefundRequest::forTransaction('555123456'), 'paymob');

// Partial refund of a Kashier order.
$result = Paykit::refund(RefundRequest::forOrder($orderId, Money::of('100.00'), 'customer asked'), 'kashier');

// Void a payment before it settles.
$result = Paykit::void(VoidRequest::forTransaction('555123456'), 'paymob');

$result->status;        // Paykit\Enums\PaymentStatus
$result->succeeded();   // true, false, or false while pending
Gateway Refund Void Addressed by
Paymob full or partial yes the numeric transaction id
Kashier full or partial yes, inside the same-day window the Kashier order id, optionally a target transaction
Fawry full or partial, amount required cancels an unpaid order the Fawry reference number
Geidea full or partial, amount required not implemented the Geidea order id
MyFatoorah full or partial; a request MyFatoorah reviews, so the result is pending until the REFUND_STATUS_CHANGED webhook not implemented the PaymentId, or the InvoiceId
Tap full or partial, amount required not implemented the Tap charge id
HyperPay full or partial, amount required not implemented the HyperPay payment id
Checkout.com full or partial; accepted async, pending until the webhook not implemented the Checkout.com payment id
PayPal full (empty body) or partial, decimal-string amount not implemented the PayPal capture id, not the order id
Stripe full or partial, minor-unit amount not implemented the Stripe payment intent id
Paystack full or partial, minor-unit amount; queued, pending until the webhook not implemented the transaction reference
Moyasar full or partial, minor-unit amount; synchronous not implemented the Moyasar payment id (UUID)
Razorpay full or partial, minor-unit amount; pending until the refund webhook not implemented the Razorpay payment id (pay_...)
Mercado Pago full (empty body) or partial, MAJOR-unit decimal amount not implemented the numeric payment id
Mollie full or partial, MAJOR-unit 2-decimal string; the amount is required on every refund not implemented the Mollie payment id (tr_...)
Adyen partial or full, MINOR-unit amount required; acknowledged, pending until the REFUND webhook not implemented the payment pspReference
Flutterwave full (no amount) or partial, MAJOR-unit amount; completed is pending disbursement, completed-* is done not implemented the transaction id (data.id); the refund's own id comes back for polling
PayTabs full or partial, MAJOR-unit amount required; only on an authorised sale or capture; P means a manual refund is pending not implemented the original tran_ref; the refund's own tran_ref comes back
Klarna full or partial, MINOR-unit amount required; synchronous against a captured order not implemented Klarna's own order id from placeOrder(), not your reference
Square full or partial, MINOR-unit amount required; PENDING until Square approves it not implemented the Square payment id
Xendit full or partial, smallest-unit amount required; PENDING until the refund webhook settles it not implemented Xendit's payment_id, which the session webhook carries
PayU full (no amount, as documented) or partial, lowest-unit amount not implemented the PayU order id
Tabby full or partial, amount required not implemented Tabby's payment id
Tamara full or partial, amount required not implemented Tamara's order id

The details that bite:

  • A driver that cannot do it says so. Paykit::refund() and Paykit::void() raise UnsupportedOperationException for a gateway that does not implement the contract, rather than sending something plausible.
  • Fawry and Geidea need the amount even for a full refund. Neither API has a "refund whatever is left" call, so pass Money on the request.
  • Fawry's void is its Cancel Unpaid Order API. It only works while the order is unpaid, and it is signed in a different order from a refund: orderRefNo + merchantAccount + lang + secureKey.
  • Kashier serves order operations from a different host. https://fep.kashier.io (https://test-fep.kashier.io in test), not the payment sessions host. Set KASHIER_OPERATION_BASE_URL if Kashier moves it.
  • Paymob's refund, void and capture endpoints sit on the acceptance API. Paykit sends the secret key as Authorization: Token ... and, when PAYMOB_API_KEY is set, also mints the short-lived auth_token those endpoints accept in the body.

Capture

Capture is the second half of an auth/capture flow: the authorization holds the money on the customer's card, the capture moves it to you. Paymob is the only driver that documents it, and only for cards.

use Paykit\Data\CaptureRequest;
use Paykit\Data\Money;

// Take the whole authorized amount. The id is the auth transaction's id.
$result = Paykit::capture(CaptureRequest::forTransaction('555123456'), 'paymob');

// Take part of it.
$result = Paykit::capture(CaptureRequest::forTransaction('555123456', Money::of('100.00')), 'paymob');

What Paymob will not let you do:

  • Only a card authorization can be captured. Paymob documents capture for the card method with the Auth transaction type, so the payment has to be created against an integration configured as Auth, not a normal sale integration.
  • Capture before the authorization expires. An authorization is a hold with a deadline. Once it lapses there is nothing left to capture, and the money goes back to the customer.
  • A partial capture cannot exceed the authorized amount. Capture the rest while the authorization is still live, or let the remainder go.
  • Every other driver refuses. Paykit::capture() raises UnsupportedOperationException for Kashier, Fawry and Geidea, which document no capture step.

Kashier

KASHIER_BASE_URL=https://api.kashier.io          # test: https://test-api.kashier.io
KASHIER_SECRET_KEY=ksk_test_...
KASHIER_PAYMENT_API_KEY=pk_test_...
KASHIER_MERCHANT_ID=MID-1234-567
KASHIER_ALLOWED_METHODS=card,wallet
KASHIER_WEBHOOK_URL=https://your-app.test/paykit/webhooks/kashier
KASHIER_REDIRECT_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('kashier')->createPayment($request);

return redirect()->away($session->checkoutUrl);

Three Kashier details worth knowing:

  • Amounts are decimal strings. Kashier takes "250.00", not piastres. Paykit formats the integer amount into a decimal string, so a 19.99 EGP payment is sent as "19.99" and never becomes 19.989999.
  • The signature is in a header. Kashier signs each webhook with HMAC-SHA256 keyed by your Payment API Key, over the keys it lists in the payload's own signatureKeys array, sorted and URL-encoded. Paykit verifies x-kashier-signature before parsing anything.
  • The redirect is signed too. Every query parameter except signature and mode, in the order received:
use Paykit\Gateways\Kashier\KashierSignature;

$query = $request->query();
$isGenuine = KashierSignature::verifyRedirect($query, $query['signature'] ?? null, config('paykit.drivers.kashier.api_key'));

Kashier's api-key header is the Payment API Key; Authorization takes the Secret Key raw, with no Bearer prefix. The two are not interchangeable, and each mode (test, live) has its own pair.

Fawry

Fawry's documented flow is different: the customer is not redirected anywhere. You create a charge, Fawry returns a reference number, and the customer pays it at any Fawry outlet.

FAWRY_BASE_URL=https://www.atfawry.com            # test: https://atfawry.fawrystaging.com
FAWRY_MERCHANT_CODE=1tSa6uxz2nTwlaAmt38enA==
FAWRY_SECURE_KEY=...
FAWRY_PAYMENT_METHOD=PayAtFawry
FAWRY_LANGUAGE=en-gb
FAWRY_NOTIFICATION_URL=https://your-app.test/paykit/webhooks/fawry
$session = Paykit::gateway('fawry')->createPayment($request);

// Show these to the customer. There is no checkout URL to redirect to.
$session->paymentReference;   // "9001234567"
$session->expiresAt;          // Fawry's expiry, as it sent it
$session->checkoutUrl;        // null

Three Fawry details worth knowing:

  • Signing is plain SHA-256, not HMAC. The digest is over merchantCode + merchantRefNum + customerProfileId (empty when absent) + paymentMethod + amount with two decimals + secureKey. The secure key is concatenated, not used as a key. Using hash_hmac here produces a different digest and Fawry rejects every request.
  • Notifications are signed the same way and arrive as messageSignature, over fawryRefNumber + merchantRefNumber + paymentAmount + orderAmount + orderStatus + paymentMethod + paymentRefrenceNumber + secureKey. Both amounts are hashed with two decimals, and the payment reference is empty on the order-creation notification. Paykit verifies this before parsing and maps orderStatus: PAID succeeded, REFUNDED and PARTIAL_REFUNDED refunded, CANCELED, EXPIRED and FAILED failed, NEW pending.
  • The callback URL is registered with Fawry, not sent per order. Fawry's operations team sets it at merchant setup; Paykit also sends it as orderWebHookUrl so a per-order override still works.

Card and wallet payments are not implemented, deliberately. Fawry's card charge API takes raw card numbers, which does not belong in a server-side package, and its hosted checkout init signature is not published. The MWALLET flow needs the customer's OTP mid-flight. Asking for either raises UnsupportedOperationException:

Paykit::gateway('fawry')->createPayment($request->withMethod('card'));   // throws, loudly

Geidea

Geidea takes a create-session call and then sends the payer to its hosted checkout page.

GEIDEA_BASE_URL=https://api.merchant.geidea.net          # KSA: https://api.ksamerchant.geidea.net, UAE: https://api.geidea.ae
GEIDEA_PUBLIC_KEY=...
GEIDEA_API_PASSWORD=...
GEIDEA_CALLBACK_URL=https://your-app.test/paykit/webhooks/geidea
GEIDEA_RETURN_URL=https://your-app.test/checkout/done
GEIDEA_PHONE_COUNTRY_CODE=+20
$session = Paykit::gateway('geidea')->createPayment($request);

return redirect()->away($session->checkoutUrl);

Three Geidea details worth knowing:

  • The public key is the Basic auth username. Every create-session request is authenticated with base64(publicKey:apiPassword) and signed with HMAC-SHA256 keyed by the API password, over publicKey + amount with two decimals + currency + merchantReferenceId + timestamp. The timestamp is Y/m/d H:i:s; set GEIDEA_TIMEZONE when the app timezone is not the one you want signed.
  • Callbacks are signed over the order object, not the whole payload. The digest covers merchantPublicKey + amount + currency + orderId + status + merchantReferenceId + timeStamp, base64 encoded. Paykit verifies signature before parsing anything. Geidea asks merchants to trust a payment only when the status is Success and both response codes are 000, so a Success with any other code is reported as failed.
  • merchantReferenceId is your payment reference. Geidea's API reference describes the field as a UUID, while its own checkout guide example sends a plain merchant reference. Paykit sends your reference unchanged so the callback matches your order; if your account rejects a non-UUID reference, pass a UUID as the PaymentRequest reference.

Which methods the hosted page offers is decided by your Geidea account, so PaymentRequest::$method is ignored by this driver.

MyFatoorah

MyFatoorah covers Kuwait, Saudi Arabia and the rest of the Gulf. The flow is an invoice link: you create an invoice, MyFatoorah returns a payment URL, and the customer pays there.

MYFATOORAH_BASE_URL=https://api.myfatoorah.com          # test: https://apitest.myfatoorah.com
MYFATOORAH_API_KEY=...
MYFATOORAH_WEBHOOK_SECRET=...
MYFATOORAH_CALLBACK_URL=https://your-app.test/checkout/done
MYFATOORAH_WEBHOOK_URL=https://your-app.test/paykit/webhooks/myfatoorah
$session = Paykit::gateway('myfatoorah')->createPayment($request);

return redirect()->away($session->checkoutUrl);

Three MyFatoorah details worth knowing:

  • Amounts are in major units. MyFatoorah takes 250.00 KWD, not fils. Paykit formats your integer amount into a decimal number, so a 19.99 payment never becomes 19.989999.
  • Every call is a POST with a Bearer token, and failures hide in a 200. MyFatoorah answers errors with HTTP 200 and IsSuccess: false in the body; Paykit checks the flag, not only the status code.
  • The webhook signature covers a documented field list. Each v2 event type signs its own ordered Key=Value list with your webhook secret (HMAC-SHA-256, base64) in the myfatoorah-signature header. Paykit rebuilds that string from the payload and verifies before parsing, and refuses an event type or transaction status it does not recognise instead of guessing.

A refund through Paykit::refund() is a request MyFatoorah's finance team executes, so the result comes back pending and the completion arrives as a REFUND_STATUS_CHANGED webhook.

Tap

Tap covers Saudi Arabia, Kuwait, the UAE and the rest of the Gulf. The flow is a hosted page: you create a charge with source src_all, Tap returns a page URL that offers every method your account enables (KNET, mada, cards), and the customer pays there.

TAP_BASE_URL=https://api.tap.payments          # one host; sk_test_... vs sk_live_... decides the mode
TAP_SECRET_KEY=sk_test_...
TAP_REDIRECT_URL=https://your-app.test/checkout/done
TAP_WEBHOOK_URL=https://your-app.test/paykit/webhooks/tap
$session = Paykit::gateway('tap')->createPayment($request);

return redirect()->away($session->checkoutUrl);

Three Tap details worth knowing:

  • One secret key does everything. It is the Bearer token on every API call and the key that signs webhooks, in the hashstring header.
  • The signed amount is currency-formatted. The hashstring recipe formats the amount to the currency's ISO 4217 scale before hashing: 2.00 for SAR but 2.000 for KWD, BHD, OMR and JOD, and a missing gateway reference keeps its label with an empty value. Paykit rebuilds that string exactly; a naive verifier that hashes the raw JSON amount rejects every real KWD webhook.
  • Refunds need the amount. Tap's refund API takes a charge_id and an amount (there is no "refund whatever is left" call), and its reason is an enum: a free-text reason maps onto requested_by_customer.

HyperPay

HyperPay is the big Saudi and Gulf acquirer behind mada. Its flow is a widget, not a redirect: a server-to-server call prepares a checkout, and your checkout page loads HyperPay's payment widget script with the checkout id.

HYPERPAY_BASE_URL=https://eu-prod.oppwa.com          # test: https://eu-test.oppwa.com
HYPERPAY_ENTITY_ID=...
HYPERPAY_ACCESS_TOKEN=...
HYPERPAY_WEBHOOK_SECRET=...                          # 64-char hex, from the webhook you configure in the back office
HYPERPAY_SHOPPER_RESULT_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('hyperpay')->createPayment($request);

// HyperPay embeds a widget: the session's checkoutUrl is the widget script,
// and intentionId is the checkout id your page's form uses.

Three HyperPay details worth knowing:

  • The webhook is encrypted, and the encryption is the signature. Every delivery is AES-256-GCM with the 64-character hex secret you configure on the webhook; the IV and authentication tag arrive in headers. A forged or tampered body fails to decrypt, so verification is openssl_decrypt or nothing. Configure the webhook in the back office (Administration -> Webhooks), test it there and activate it.
  • Status comes from result codes, not a status word. Paykit maps the documented families: 000.000.*, 000.100.1**, 000.3**, 000.6** and the 000.400.0**/000.400.100 "review manually" codes are success; 000.200.** and the two async-review groups are pending; everything else fails closed.
  • Refunds are backoffice calls. POST /v1/payments/{id} with paymentType=RF and an amount; there is no full-refund shortcut.

Checkout.com

Checkout.com serves MENA from its Dubai hub on the same global API. The flow is a Hosted Payments Page: you create a hosted payment, Checkout.com returns a redirect link, and the customer pays there.

CHECKOUTCOM_BASE_URL=https://api.checkout.com          # sandbox: https://api.sandbox.checkout.com
CHECKOUTCOM_SECRET_KEY=sk_sbox_...
CHECKOUTCOM_WEBHOOK_SECRET=...                         # the signature key generated on your webhook in the Dashboard
CHECKOUTCOM_SUCCESS_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('checkoutcom')->createPayment($request);

return redirect()->away($session->checkoutUrl);

Three Checkout.com details worth knowing:

  • Amounts are integers in the minor unit. 25000 is 250.00 SAR. Paykit sends the integer amount directly, so a 19.99 payment never becomes 19.989999.
  • The signature covers the raw body, byte for byte. Cko-Signature is HMAC-SHA-256 (hex) keyed by the webhook's signature key over the exact bytes received; re-serialising the JSON before verifying breaks every signature. Paykit verifies the raw body, then parses.
  • A refund is accepted, not completed. The API answers 202 with an action id; the completion arrives as a payment_refunded webhook, so Paykit::refund() reports pending. Event types the driver does not map (disputes, card verification) are refused, never guessed.

PayPal

PayPal is the first international driver: server-side Orders v2, no JavaScript SDK. You create an order, redirect the customer to PayPal's approve link, PayPal brings them back to your return URL, and you capture.

PAYPAL_BASE_URL=https://api-m.paypal.com          # sandbox: https://api-m.sandbox.paypal.com
PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
PAYPAL_WEBHOOK_ID=...                             # the webhook you subscribe in the Developer dashboard
PAYPAL_RETURN_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('paypal')->createPayment($request);

return redirect()->away($session->checkoutUrl);   // PayPal's approve page

// On the return URL, capture the approved order (the query's `token` is the order id):
$result = Paykit::gateway('paypal')->capture(CaptureRequest::forTransaction($request->query('token')));

Four PayPal details worth knowing:

  • Capture is a second, required call. An approved order moves no money until you capture it; CHECKOUT.ORDER.APPROVED webhooks stay pending in Paykit for exactly that reason. PayPal captures the full approved amount, so a partial capture is refused rather than silently taking more.
  • PayPal is its own webhook verifier. There is no local HMAC recipe to get wrong: the five PAYPAL-TRANSMISSION-* headers plus the received event go back to PayPal's verify-webhook-signature endpoint, and only SUCCESS is accepted. The webhook id from the Developer dashboard is part of that check.
  • Amounts are decimal strings, not integers. "250.00" USD. Paykit formats from minor units, so 19.99 never arrives as 19.989999.
  • No EGP, no Gulf currencies. PayPal's supported-currency list is 24 currencies (USD, EUR, GBP and similar); Egyptian and Gulf merchants charge in a supported currency and PayPal converts into the account balance. For local EGP collection the Egyptian drivers remain the answer.

A refund addresses the capture id, not the order id; an empty amount refunds whatever is left, an amount is a partial refund. Fixture-tested only, no live PayPal account has run it yet.

Stripe

Stripe joins as the second international driver, on hosted Checkout Sessions: you create a session, redirect the customer to Stripe's page, and webhooks settle the state.

STRIPE_SECRET_KEY=sk_live_...                        # sk_test_... on the test side, same host
STRIPE_WEBHOOK_SECRET=whsec_...                      # the endpoint you create in the Dashboard
STRIPE_SUCCESS_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('stripe')->createPayment($request);

return redirect()->away($session->checkoutUrl);

Four Stripe details worth knowing:

  • The signature recipe is public, and Paykit follows it to the letter. Stripe-Signature carries t= plus one or more v1= signatures; the expected value is HMAC-SHA-256 of {t}.{raw body} keyed by the endpoint's whsec_ secret, compared in constant time. Other schemes are discarded (v0 is Stripe's documented test-only scheme, so ignoring it is the documented downgrade protection), and a signed timestamp older than five minutes is rejected as a replay.
  • A completed session is not always money. checkout.session.completed fires for async methods before the funds move; Paykit reads the documented payment_status and reports pending unless it is paid.
  • Amounts are minor units again. 25000 is 250.00 USD, sent as an integer - the same convention as the Egyptian drivers.
  • Availability is the real limit. Stripe merchant accounts are not available in Egypt or most of the Gulf (the UAE is the exception on stripe.com/global). The driver serves the package's international audience; Egyptian merchants keep the local drivers.

A refund addresses the payment intent id; an omitted amount refunds whatever is left, an amount is a partial refund in minor units. Fixture-tested only, no live Stripe account has run it yet.

Paystack

Paystack is the third international driver and the package's first African specialist: a hosted checkout for Nigeria, Ghana, South Africa and Kenya (NGN, GHS, ZAR, KES, and USD for some businesses).

PAYSTACK_SECRET_KEY=sk_live_...                      # sk_test_... on the test side, same host
PAYSTACK_WEBHOOK_SECRET=whsec_...                    # Developers -> API configuration
PAYSTACK_CALLBACK_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('paystack')->createPayment($request);

return redirect()->away($session->checkoutUrl);

Four Paystack details worth knowing:

  • The email is the API's demand, not Paykit's. POST /transaction/initialize requires the customer's email, so the driver refuses a request without one instead of letting the API reject it.
  • Two documented signature schemes, both honoured. The current Paystack-Signature header carries t= and v1= entries; the expected value is HMAC-SHA-512 of {t}.{raw body} keyed by the dashboard's whsec_ signing secret, with the documented 300-second replay tolerance. Webhooks still arriving with the legacy x-paystack-signature (plain HMAC-SHA-512 of the raw body under the API secret key) verify against the secret key instead.
  • The reference is the handle. Verification after the redirect is GET /transaction/verify/{reference}, exposed as verifyTransactionStatus(), and refunds address the same reference.
  • A refund is a queue, not a verdict. POST /refund answers 200 with the refund pending; the money settles when a refund.processed (or refund.failed) webhook lands, so the driver reports Pending and lets the webhook flip the state.

Amounts are minor units again - 2500000 is 25,000.00 NGN. Fixture-tested only, no live Paystack account has run it yet.

Moyasar

Moyasar is the fourth international driver and the Saudi specialist: one API for mada, Visa/Mastercard/Amex, Apple Pay, Samsung Pay, STC Pay and SADAD bills.

MOYASAR_SECRET_KEY=sk_live_...                       # sk_test_... on the test side, same host
MOYASAR_WEBHOOK_SECRET=the-token-you-registered      # Settings -> Webhooks, your own choice
MOYASAR_CALLBACK_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('moyasar')->createPayment($request);

return redirect()->away($session->checkoutUrl); // the 3DS challenge

Five Moyasar details worth knowing:

  • There is no hosted page. Moyasar's model is embed-the-form or direct API, so a card payment carries the card the customer entered in extras.card (name, number, month, year, cvc) - your page's PCI scope, not Paykit's. When the payment comes back initiated, source.transaction_url is the documented 3DS challenge; that is the session's checkout url.
  • STC Pay is a source type, not a redirect. method: 'stcpay' with extras.mobile (05xxxxxxxx, +9665... or 009665...) creates the payment and the customer completes it by OTP on their phone; there is no checkout url. The OTP proceed step (POST /stc_pays/{id}/proceed) is documented but interactive, so Paykit creates the payment and leaves the OTP step to your UI for now.
  • You name the payment id. The documented given_id (a UUID you generate) becomes the payment id - Moyasar's built-in idempotency. Pass your own in extras.given_id or the driver generates one; your merchant reference always rides in metadata.reference and comes back on every response and webhook.
  • Webhook verification is a shared token, not a signature. Moyasar echoes the secret token you registered in each payload's secret_token field; the driver compares it in constant time. That is the documented scheme - weaker than an HMAC, so serve the endpoint over HTTPS and keep the token long and random.
  • Refunds are synchronous. POST /v1/payments/{id}/refund flips the status to refunded in the response; an omitted amount refunds whatever was charged. fetchPaymentStatus() is the documented GET /v1/payments/{id} check after the callback.

Fixture-tested only, no live Moyasar account has run it yet.

Razorpay

Razorpay is the fifth international driver and the India specialist. The flagship Standard Checkout is a browser JS modal with no hosted url, so this driver builds on the documented hosted product instead: Payment Links.

RAZORPAY_KEY_ID=rzp_live_...                          # rzp_test_... on the test side, same host
RAZORPAY_KEY_SECRET=...
RAZORPAY_WEBHOOK_SECRET=...                           # Dashboard -> Webhooks, a separate secret
RAZORPAY_CALLBACK_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('razorpay')->createPayment($request);

return redirect()->away($session->checkoutUrl); // the rzp.io short url

Five Razorpay details worth knowing:

  • Your reference has rules. The documented reference_id is unique per link and capped at 40 characters; the driver refuses a longer one up front, and the API refuses a reused one.
  • Three documented signatures, two implemented, one not ours. Webhooks carry X-Razorpay-Signature, HMAC-SHA-256 of the raw body under the webhook secret (verified constant-time, before any parsing). The browser callback carries razorpay_signature, HMAC-SHA-256 of payment_link_id|reference_id|status|payment_id under the API key secret - verify it with verifyCallbackSignature($query) when the payer returns. The third recipe (Standard Checkout's order_id|payment_id) belongs to the JS-modal flow this driver does not use.
  • Captured, not authorized, is the money. payment.authorized means the funds are held; the documented "safe to deliver" signals are payment.captured, order.paid and payment_link.paid, and those are what the driver reports as succeeded.
  • Refunds are a state machine, and idempotent. POST /v1/payments/{pay_id}/refund moves pending -> processed | failed, so the driver reports pending unless the response already says processed. The documented X-Refund-Idempotency header is sent with a deterministic key, so a retried refund never doubles.
  • Notifications stay yours. Razorpay offers to SMS/email the customer about the link; the driver switches that off, your app owns its customer communication.

Amounts are minor units again - 50000 is 500.00 INR. Fixture-tested only, no live Razorpay account has run it yet.

Mercado Pago

Mercado Pago is the sixth international driver and the Latin America specialist (Argentina, Brazil, Mexico, Chile, Colombia, Peru, Uruguay), on the hosted Checkout Pro product.

MERCADOPAGO_ACCESS_TOKEN=APP_USR-...                  # TEST-... on the test side, same host
MERCADOPAGO_WEBHOOK_SECRET=...                        # Your integrations -> Webhooks
MERCADOPAGO_SUCCESS_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('mercadopago')->createPayment($request);

return redirect()->away($session->checkoutUrl); // the init_point

Four Mercado Pago details worth knowing:

  • The units flip. Almost every other driver takes minor units; Mercado Pago's documented convention is MAJOR units with decimals - 850.5 is 850.50 BRL, on preferences and refunds alike. The driver converts, your Money stays the same.
  • Redirect to init_point, never sandbox_init_point. The preference response carries both; the docs are explicit that the sandbox url is not the one to send payers to.
  • A notification is a signal, not the state. The webhook body carries only {type: "payment", data: {id}} - no status. After verifying the signature, the driver fetches GET /v1/payments/{id} and reports that, exactly the documented practice.
  • The signature signs a manifest, not the body. x-signature carries ts= (milliseconds) and v1=; the expected value is HMAC-SHA-256 of id:{data.id};request-id:{x-request-id};ts:{ts}; keyed by the webhook secret, compared in constant time, with the official SDKs' 300-second tolerance on the timestamp.

Refunds take an empty body for a full refund, a major-unit amount for a partial, and the documented X-Idempotency-Key header goes along. Only approved payments can be refunded, within 180 days. Fixture-tested only, no live Mercado Pago account has run it yet.

Mollie

Mollie is the seventh international driver and the Europe specialist (iDEAL, Bancontact, SEPA, Klarna, cards, PayPal and dozens more European methods), on its hosted checkout page.

MOLLIE_API_KEY=live_...                                # test_... on the test side, same host
MOLLIE_REDIRECT_URL=https://your-app.test/checkout/done
MOLLIE_WEBHOOK_URL=https://your-app.test/webhooks/mollie
$session = Paykit::gateway('mollie')->createPayment($request);

return redirect()->away($session->checkoutUrl); // the _links.checkout href

Three Mollie details worth knowing:

  • The units flip again. Like Mercado Pago, Mollie's documented convention is MAJOR units, carried as a 2-decimal string: {"currency": "EUR", "value": "1000.00"}. The driver converts, your Money stays the same.
  • The webhooks are unsigned on purpose. The POST carries only a form-encoded id (tr_...) - no status, no signature. The documented security model is that you fetch the payment over the authenticated API, so a fake webhook call can never mark anything paid: the status never rides in the webhook, and the driver always fetches before reporting. Unknown ids still deserve a 200 OK, per the docs.
  • Every refund carries an amount. There is no empty-body full refund here; the amount object is required on full and partial refunds alike, so for a full refund the driver fetches the payment's own amount and sends it back.

The status vocabulary: open/pending/authorized are money not settled yet, paid is success, and canceled/expired/failed are failures. Fixture-tested only, no live Mollie account has run it yet.

Adyen

Adyen is the eighth international driver and the global enterprise specialist, on the Checkout API v71 sessions product: one hosted page, hundreds of methods worldwide.

ADYEN_API_KEY=AQE...                                   # Customer Area -> Developers -> API credentials
ADYEN_MERCHANT_ACCOUNT=YourMerchantECOM
ADYEN_HMAC_KEY=44782DEF...                             # Customer Area -> Developers -> Webhooks -> your endpoint -> Security (a HEX string)
ADYEN_RETURN_URL=https://your-app.test/checkout/done
# Live: ADYEN_BASE_URL=https://{your-prefix}-checkout-live.adyenpayments.com/v71
$session = Paykit::gateway('adyen')->createPayment($request);

return redirect()->away($session->checkoutUrl); // the hosted checkout url

Three Adyen details worth knowing:

  • Back to MINOR units. After Mercado Pago and Mollie's major-unit conventions, Adyen's documented amounts are minor units again: 1130 is 11.30 EUR, on sessions and refunds alike. The driver converts, your Money stays the same.
  • The signature signs a colon-joined payload, not the body. Each Standard-webhook item's additionalData.hmacSignature is base64(HMAC-SHA-256(pspReference:originalReference:merchantAccountCode:merchantReference:value:currency:eventCode:success)) keyed by the HEX-decoded Customer-Area HMAC key. The driver verifies every item in the batch before parsing any, and the official docs' own worked example is a fixture test.
  • Refunds are asynchronous. POST /v71/payments/{pspReference}/refunds (documented Idempotency-Key header sent) only acknowledges the request; the outcome arrives in a REFUND webhook, so a refund reports pending until then. The amount is required on every refund - there is no empty-body full refund - and Adyen settles status by webhook, so there is no fetchPaymentStatus() here.

Fixture-tested only, no live Adyen account has run it yet.

Flutterwave

Flutterwave is the ninth international driver and the African specialist beyond Paystack's four countries (Nigeria, Ghana, Kenya, South Africa, Uganda, Rwanda, Tanzania and Francophone West Africa), on its hosted Checkout product.

FLUTTERWAVE_SECRET_KEY=FLWSECK-...                         # FLWSECK_TEST-... on the test side, same host
FLUTTERWAVE_SECRET_HASH=...                                # Dashboard -> Settings -> Webhooks
FLUTTERWAVE_REDIRECT_URL=https://your-app.test/checkout/done
FLUTTERWAVE_PAYMENT_OPTIONS=card, ussd, mobilemoneyghana   # optional
$session = Paykit::gateway('flutterwave')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four Flutterwave details worth knowing:

  • Major units again. Like Mercado Pago and Mollie, the documented amount is in major units - 7500 is 7,500 naira, on payments and refunds alike. Whole amounts go on the wire as integers and anything with kobo as a decimal string, so no amount is ever rounded through a float.
  • The webhook proves who sent it; the API proves what happened. There is no HMAC: Flutterwave echoes the secret hash you set in the dashboard back in a verif-hash header. The driver compares it in constant time and then re-reads the transaction with GET /v3/transactions/{id}/verify, which is what the docs tell you to do before giving value. A failed payment also arrives as charge.completed, so the status is read from the data, never from the event name.
  • A refund that says completed is not finished. The documented vocabulary is blunt about it: completed means the refund was initiated and is waiting for disbursement; only completed-mpgs, completed-bank-transfer, completed-momo, completed-offline and completed-preauth are done, and those map to refunded. Everything else stays pending, and failed is a failure.
  • Refund notifications are a different shape. They arrive as a flat PascalCase object with no event field, and are settled the same way: GET /v3/refunds/{id}. They carry no currency, so the amount is labelled with FLUTTERWAVE_CURRENCY (NGN by default).

Refunds take the transaction id (data.id); omit the amount for a full refund. Fixture-tested only, no live Flutterwave account has run it yet.

PayTabs

PayTabs is the tenth international driver and the Gulf's own processor: licensed locally in Saudi Arabia, the UAE, Egypt, Oman, Jordan, Kuwait, Qatar, Morocco and Iraq, so it is the one a Gulf merchant can onboard with where Stripe has no account.

PAYTABS_PROFILE_ID=987654
PAYTABS_SERVER_KEY=...                              # Dashboard -> Developers -> Key management
PAYTABS_BASE_URL=https://secure-egypt.paytabs.com    # your region's host; the wrong one fails authentication
PAYTABS_CALLBACK_URL=https://your-app.test/paykit/webhooks/paytabs
PAYTABS_RETURN_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('paytabs')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four PayTabs details worth knowing:

  • The region is part of the credential. Every call goes to your profile's own host (secure-egypt, secure-saudi, secure-oman, and so on); the same key against another region's host fails authentication. It is configuration, never a constant.
  • The callback is signed over the raw body. The Signature header is the hex HMAC-SHA-256 of the exact bytes PayTabs sent, keyed by the Server Key. The browser return post is signed differently - sorted, URL-encoded, non-empty fields - so the driver offers verifyReturnSignature() for display, and still treats only the callback as proof.
  • Hold and pending are not paid. The documented set is A authorised, H on hold for anti-fraud review, P pending (cash methods, or a refund the finance team processes by hand), V voided, E error, D declined, X expired. Only A succeeds; H and P come through as pending, and a code outside the set is refused rather than guessed.
  • Refunds need an amount. There is no "refund everything" call: pass Money, and it must not exceed the original transaction. A P on a refund means PayTabs is processing it by hand.

Payments and refunds carry PayTabs' own tran_ref; your reference rides along as the cart_id. Fixture-tested only, no live PayTabs account has run it yet.

Klarna

Klarna is the eleventh international driver and the BNPL specialist: Sweden and the Nordics, most of Europe, the UK and the US. It is also the only driver where a completed payment page is not the end of the story. Klarna documents a third step, placing the order, and until that call the customer has authorised but nothing has been charged.

KLARNA_BASE_URL=https://api.playground.klarna.com    # https://api.klarna.com for live
KLARNA_USERNAME=...                                   # Merchant portal -> Settings -> API credentials
KLARNA_PASSWORD=...
KLARNA_PURCHASE_COUNTRY=SE
KLARNA_LOCALE=en-SE
KLARNA_CURRENCY=SEK
KLARNA_RETURN_URL=https://your-app.test/checkout/done
KLARNA_CALLBACK_URL=https://your-app.test/paykit/webhooks/klarna
KLARNA_CALLBACK_TOKEN=...                             # a long random string you generate
$session = Paykit::gateway('klarna')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four Klarna details worth knowing:

  • An authorization is not money. createPayment() creates the payment session and the hosted page built on it, and returns the redirect. When the customer comes back on the success url, Klarna has put an authorization_token there, and you must call placeOrder($token, $request) within 60 minutes. That call creates the order you are paid against, and its order_id is the only handle a refund takes. placeOrder() returns an OperationResult: REJECTED fails, PENDING stays pending, anything else succeeds. There is no fetchPaymentStatus() and no webhook that replaces this step, so the driver says so rather than pretending a redirect is a sale.
  • The callback is authenticated by a one-time token, not a signature. Klarna posts {event_id, session} to your status_update url and documents no HMAC. The documented scheme is a one-time secret per session carried in that url: set KLARNA_CALLBACK_TOKEN, the driver appends it to the status_update url, compares it in constant time, then re-reads the session through the authenticated API. A post without the right token is refused before any API call, and a post with the right token still cannot invent a status, because the API read decides. The session carries no amount, so WebhookEvent reports 0: compare amounts from placeOrder(), never from the callback.
  • Minor units, and a market you name. 9500 is 95.00 SEK. The session also carries purchase_country and locale, because Klarna prices the installments per market: set them to the market you actually sell into, not to the default.
  • Refunds need an amount and Klarna's order id. refunded_amount is required and must not exceed what was captured, and the order is addressed by the order_id that placeOrder() returned, not by your reference. The documented Klarna-Idempotency-Key header is sent, so a retried refund stays one refund.

Payments and refunds carry Klarna's own ids; your reference rides along as merchant_reference1. Fixture-tested only, no Klarna account has run it yet.

Square

Square is the twelfth international driver: one account covering the US, Canada, the UK, Ireland, Australia, Japan, France and Spain, on the hosted Checkout product. You create a payment link, send the buyer to it, and the payment arrives as a notification.

SQUARE_BASE_URL=https://connect.squareup.com            # sandbox: https://connect.squareupsandbox.com
SQUARE_ACCESS_TOKEN=...                                  # Developer Console -> your application -> Access token
SQUARE_LOCATION_ID=L88917AVBK2S5
SQUARE_SQUARE_VERSION=2026-11-18                         # the API version you pin
SQUARE_SIGNATURE_KEY=...                                 # Webhooks -> your subscription
SQUARE_NOTIFICATION_URL=https://your-app.test/paykit/webhooks/square
SQUARE_RETURN_URL=https://your-app.test/checkout/done
$session = Paykit::gateway('square')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four Square details worth knowing:

  • The notification URL is part of the signature. Square signs the notification URL followed by the raw body with HMAC-SHA-256 under the subscription's signature key, base64, in x-square-hmacsha256-signature. SQUARE_NOTIFICATION_URL therefore has to match the URL you registered byte for byte, scheme and host included, or every signature check fails. The driver compares in constant time, refuses a body it cannot see the raw bytes of, and then re-reads the payment through the API: the notification is the signal, the read is the truth.
  • An APPROVED payment is not captured money. The documented statuses are APPROVED, PENDING, COMPLETED, CANCELED and FAILED. Only COMPLETED comes through as paid; APPROVED and PENDING are pending, the other two fail, and a status outside the set is refused rather than guessed.
  • Your reference rides back as the payment note. Square copies the link's note onto the resulting payment, so the driver sends your reference there and reads it back from the payment, which is why a callback can be matched to your order without a second lookup table.
  • Refunds need an amount and the payment id. amount_money is required on every refund and cannot exceed what is left of the payment; the refund is its own resource addressed by the Square payment id, and it comes back PENDING until Square approves it. The idempotency key is kept inside Square's 45-character limit.

Refunds also arrive as refund.created / refund.updated notifications, which the driver parses: APPROVED is refunded, PENDING is pending, REJECTED and FAILED fail. Fixture-tested only, no Square account has run it yet.

Xendit

Xendit is the thirteenth international driver and the South-East Asia specialist: Indonesia, the Philippines, Malaysia, Thailand, Vietnam and Singapore, on Payment Sessions in PAYMENT_LINK mode - the product Xendit's own docs point new integrations at, with the older Invoice API listed under "migrate to Payment Session".

XENDIT_BASE_URL=https://api.xendit.co
XENDIT_SECRET_KEY=...                                    # Dashboard -> Settings -> Developers -> API keys
XENDIT_API_VERSION=2024-11-11                            # the documented version header
XENDIT_CALLBACK_TOKEN=...                                # Dashboard -> Settings -> Developers -> Webhooks
XENDIT_COUNTRY=ID
XENDIT_CURRENCY=IDR
XENDIT_RETURN_URL=https://your-app.test/checkout/done
XENDIT_CANCEL_URL=https://your-app.test/checkout/cancelled
$session = Paykit::gateway('xendit')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four Xendit details worth knowing:

  • Authentication is Basic with the secret key as the username and an empty password. Xendit documents it that way, colon included, and the driver sends it that way. Every call also carries the api-version header, because Xendit versions its API per request rather than per host.
  • Webhooks are authenticated by x-callback-token, and nothing else. There is no HMAC to compute: Xendit echoes the token from your dashboard's webhook settings in that header, and its docs are explicit that comparing it is how you know an event came from them. The driver compares it in constant time, refuses a missing or wrong token, and then reads only the documented events: payment_session.completed and payment_session.expired. There is no fetch-on-callback here, because Xendit's documented authentication for this flow is the token; the driver compensates by refusing any status outside the documented set rather than guessing.
  • A completed event is checked against the session's own status. The documented statuses are COMPLETED, ACTIVE, EXPIRED and CANCELED: only COMPLETED is paid, ACTIVE comes through as pending, the other two fail. An event that says completed while the session says otherwise comes through pending, never paid.
  • Refunds are keyed by Xendit's payment_id, not by the session or your reference. The session webhook carries that id when a payment completes, which is where you take it from. The amount is required, and the reason is a fixed enum rather than free text: a documented code you pass through is kept, anything else becomes REQUESTED_BY_CUSTOMER. The result is SUCCEEDED, PENDING or FAILED, and a pending refund settles through its own webhook.

Amounts are the currency's smallest unit, the same convention as most drivers here. Fixture-tested only, no Xendit account has run it yet.

Telr

Telr is the fourteenth international driver and a Gulf acquirer: the UAE, Saudi Arabia and the wider region, on the hosted payment page. One endpoint does the work - POST /gateway/order.json - with a method of create for the page and check for a status read.

TELR_BASE_URL=https://secure.telr.com/gateway
TELR_STORE=1234                      # Merchant Administration System -> store id
TELR_AUTH_KEY=...                    # the API auth key
TELR_SECRET_KEY=...                  # the secret key the advice hash is keyed by
TELR_TEST_MODE=0                     # 1 puts the payment page in test mode
TELR_AUTHORISED_URL=https://your-app.test/checkout/done
TELR_DECLINED_URL=https://your-app.test/checkout/declined
TELR_CANCELLED_URL=https://your-app.test/checkout/cancelled
$session = Paykit::gateway('telr')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four Telr details worth knowing:

  • The advice hash is SHA1 over a fixed field list. Telr documents it as the secret key followed by fourteen transaction fields - store, type, class, test flag, ref, previous ref, first ref, currency, amount, cart id, description, status, auth code, auth message - joined with colons in that order, with percent-encoded characters decoded first and a missing field contributing an empty value. The driver builds exactly that string and compares in constant time. card_check, bill_check and acquirer_check exist for the other sections; the transaction hash is the one that decides a payment.
  • H is not paid. The documented statuses are A authorised, H authorised but placed on hold for manual inspection, D declined, C cancelled and E error. Only A comes through as paid, H as pending, and a status outside the set is refused rather than guessed.
  • Amounts are major units as decimal strings. 95.00, not 9500, the same convention as Kashier and PayTap; the driver formats from your Money so nothing rounds through a float.
  • The store id and auth key travel in the body, not a header. That is how Telr documents the call, and it is configuration here, never a constant.

Refunds are not wrapped: Telr documents them through a different product surface, and this driver does not claim what it has not been grounded in. Fixture-tested only, no Telr account has run it yet.

Viva.com

Viva.com is the fifteenth international driver: a Greek acquirer with a wide European footprint, on Smart Checkout. You create a payment order, send the customer to the checkout page it belongs to, and Viva tells you what happened with a signed webhook.

VIVA_BASE_URL=https://api.vivapayments.com             # demo: https://demo-api.vivapayments.com
VIVA_ACCOUNTS_URL=https://accounts.vivapayments.com    # demo: https://demo-accounts.vivapayments.com
VIVA_CLIENT_ID=...                                     # Smart Checkout client credentials
VIVA_CLIENT_SECRET=...
VIVA_SOURCE_CODE=8362                                  # the 4-digit payment source from the Viva app
VIVA_WEBHOOK_SECRET=...                                # the webhook signing secret
VIVA_CHECKOUT_URL=https://www.vivapayments.com/web/checkout
VIVA_REQUEST_LANGUAGE=en-GB
$session = Paykit::gateway('viva')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four Viva.com details worth knowing:

  • Two hosts and an OAuth2 token. Orders go to the API host, the token to the accounts host: client credentials, grant_type=client_credentials, the client id and secret as Basic auth. The driver fetches the token once per instance and reuses it.
  • The order code is a 16-digit string. Viva's docs are explicit that it must be handled as a string, because a JavaScript number cannot hold it. The driver keeps it a string everywhere and builds the documented checkout url (?ref={OrderCode}) from it.
  • Webhooks are signed over the raw body. Viva-Signature-256 is the hex HMAC-SHA-256 of the body under the webhook secret, Viva-Signature the SHA-1 equivalent; the driver prefers the 256 one, falls back to the 1 one, compares in constant time, and refuses a body whose raw bytes it cannot see. It then reads only the documented events (1796 payment created, 1797 reversal created, 1798 payment failed, 4865 order updated) and requires the event and the transaction's own StatusId to agree - a notification that claims success for a failed transaction is refused, not believed.
  • F is finished, and only F is money. The documented statuses are F finished, A active, C captured, E error, R refunded, X cancelled: F is paid, A and C come through pending, R refunded, E and X failed, and anything else is refused. Amounts arrive in minor units with the currency as an ISO numeric code (978 is EUR), which the driver maps before building Money.

Refunds are not wrapped: Viva documents them on a separate product surface that this driver has not been grounded in. Fixture-tested only, no Viva account has run it yet.

PayU

PayU is the sixteenth international driver, on the European platform at secure.payu.com. That is PayU Global, not PayU India, which is a different product with a different API: if you are on the Indian platform, this driver is not the one.

PAYU_BASE_URL=https://secure.payu.com        # sandbox: https://secure.snd.payu.com
PAYU_CLIENT_ID=...                           # from the POS in the management panel
PAYU_CLIENT_SECRET=...
PAYU_POS_ID=145227
PAYU_SECOND_KEY=...                          # the POS's second key, which signs notifications
PAYU_NOTIFY_URL=https://your-app.test/paykit/webhooks/payu
PAYU_CONTINUE_URL=https://your-app.test/checkout/done
PAYU_CUSTOMER_IP=127.0.0.1
PAYU_LANGUAGE=en
$session = Paykit::gateway('payu')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four PayU details worth knowing:

  • The token endpoint wants a form. POST /pl/standard/user/oauth/authorize with grant_type=client_credentials, the client id and secret in the body, and the form content type: PayU's docs are explicit that without it the call is a 401. The driver fetches the token once per instance and reuses it.
  • Notifications are signed with the POS's second key. OpenPayu-Signature carries signature=<md5>;algorithm=MD5;content=DOCUMENT, and the hash is MD5 of the raw body concatenated with that second key. The driver parses the header, compares in constant time, refuses a body whose raw bytes it cannot see, and refuses an algorithm it has not been grounded in rather than approximating one.
  • Only COMPLETED is money. The documented statuses are PENDING, WAITING_FOR_CONFIRMATION, COMPLETED and CANCELED: the first two are pending, CANCELED fails, and anything else is refused. Your reference rides along as extOrderId and comes back in the notification.
  • Amounts are the lowest currency unit, as strings. "9500" is 95.00 PLN. A refund omits the amount for a full refund and sends it for a partial one, exactly as PayU documents; when PayU's answer does not say the refund is final, the driver reports pending rather than claiming money has moved.

Fixture-tested only, no PayU account has run it yet.

Tabby

Tabby is the seventeenth international driver and the first buy-now-pay-later one: the customer is redirected to Tabby's hosted checkout, approved or declined there, and you capture the payment afterwards. Tabby operates in the UAE and Saudi Arabia, and its docs say every call has to go to the base URL of your own region.

TABBY_BASE_URL=https://api.tabby.ai           # Saudi Arabia: https://api.tabby.sa
TABBY_SECRET_KEY=sk_test_...                  # or sk_... in production
TABBY_MERCHANT_CODE=merchant-ae
TABBY_WEBHOOK_AUTH_HEADER=X-Auth-Key
TABBY_WEBHOOK_AUTH_VALUE=...                  # the value you registered with Tabby
TABBY_SUCCESS_URL=https://your-app.test/checkout/done
TABBY_CANCEL_URL=https://your-app.test/checkout/cancel
TABBY_FAILURE_URL=https://your-app.test/checkout/failed
$session = Paykit::gateway('tabby')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four Tabby details worth knowing:

  • Tabby does not sign its webhooks, and the driver does not pretend otherwise. Tabby's documented check is a custom header you choose when you register the webhook (X-Auth-Key with your own value). The driver compares that header with the configured value in constant time and refuses anything else. That is the whole documented authentication, so nothing stronger is claimed.
  • AUTHORIZED is not money. Tabby authorises, and only a captured payment becomes CLOSED and settles to you. The driver reports AUTHORIZED as pending, implements capture (POST /api/v2/payments/{id}/captures) and reports CLOSED as paid. Tabby may auto-capture after 21 days, which is a reason to capture, not a reason to skip it.
  • Statuses arrive in two spellings. Webhooks send lowercase (authorized), the retrieve endpoint answers uppercase (AUTHORIZED). Both are read. The documented set is closed - CREATED, AUTHORIZED, CLOSED, REJECTED, EXPIRED - and anything else is refused.
  • Amounts are decimal strings, not minor units. "340.00" is 340 dirhams, and the documented currencies are AED and SAR. A refund always carries its amount: Tabby has no amount-less full refund, so a refund request without one is refused before a request is made.

Fixture-tested only, no Tabby account has run it yet.

Tamara

Tamara is the eighteenth international driver and the second buy-now-pay-later one, for Saudi Arabia, the UAE, Bahrain, Kuwait and Oman. Its checkout is hosted, but its flow has one step Tabby's does not: after Tamara approves an order you have to confirm it before it counts as paid.

TAMARA_BASE_URL=https://api.tamara.co          # sandbox: https://api-sandbox.tamara.co
TAMARA_API_TOKEN=...
TAMARA_NOTIFICATION_TOKEN=...                  # the HS256 secret Tamara signs webhooks with
TAMARA_COUNTRY_CODE=SA
TAMARA_LOCALE=en_US
TAMARA_SUCCESS_URL=https://your-app.test/checkout/done
TAMARA_FAILURE_URL=https://your-app.test/checkout/failed
TAMARA_CANCEL_URL=https://your-app.test/checkout/cancel
$session = Paykit::gateway('tamara')->createPayment($request);

header('Location: '.$session->checkoutUrl);

Four Tamara details worth knowing:

  • Notifications are a JWT, not a body signature. Tamara sends tamaraToken both as Authorization: Bearer and as the tamaraToken query parameter. It is an HS256 JWT signed with your notification token. The driver verifies that signature with hash_hmac and a constant-time compare, checks the expiry, and refuses any other algorithm rather than accepting an unsigned token.
  • approved is not paid. Tamara's docs are explicit that the order becomes paid at authorised, and that you call POST /orders/{order_id}/authorise after the approved notification (unless Tamara's auto-authorisation is on for your account). The driver reports approved as pending and exposes that call as authorise(), so nothing is fulfilled before it is made.
  • Amounts are major units in an object. {"amount": 300, "currency": "SAR"}, with 2 decimals by default and 3 for BHD, KWD and OMR. The currencies are the ones Tamara operates in, and country_code is one of SA, AE, BH, KW, OM.
  • Capture is not wrapped. Tamara's capture call wants the order's items sent back with it. That is a bigger surface than this driver claims, so it is left to your own call against the documented API and the README says so rather than pretending otherwise. Refunds need their amount: Tamara has no amount-less full refund.

Fixture-tested only, no Tamara account has run it yet.

Manual payments: Vodafone Cash and InstaPay

Vodafone Cash and InstaPay publish no merchant API, so the honest way to accept them is the way Egyptian shops already do it: the customer transfers to your wallet or InstaPay handle, quotes a reference, and you confirm the money arrived. Paykit ships that as a driver named manual.

It is not a gateway, and nothing about it is automatic: a human decision settles the payment. What the package does is the boring, dangerous part once: a reference nobody can guess, an amount the customer cannot change, a private place for receipts, and the same PaymentSucceeded event the gateways raise.

PAYKIT_VODAFONE_CASH_NUMBER=01000000000
PAYKIT_INSTAPAY_HANDLE=merchant@instapay
PAYKIT_MANUAL_PANEL_ABILITY=manage-payments
$session = Paykit::createPayment($request->withMethod('vodafone_cash'), 'manual');

$session->paymentReference;      // MAN-7F3K9QX2AB, the code the customer quotes
$session->raw['account'];        // where the money goes
$session->raw['amount'];         // "250.00 EGP"
$session->raw['instructions'];   // one sentence to show the customer as-is

The journey:

  1. You open the payment. Paykit::createPayment($request, 'manual') writes a row and returns the reference, the account and the amount. Show them to the customer.
  2. The customer transfers and says so. POST /paykit/manual/{reference}/proof takes transfer_reference and an optional proof upload. The reference is the only credential, so it is unguessable and the route is rate limited.
  3. You decide. GET /paykit/manual/panel lists what is open, with the receipt behind an authorized link. Approving raises PaymentSucceeded; rejecting raises PaymentFailed. Both carry the amount stored on the row, never one from the form.

Publish the migration and migrate (paykit_manual_payments); the views are publishable if you want to restyle the panel:

php artisan vendor:publish --tag=paykit-migrations
php artisan vendor:publish --tag=paykit-views
php artisan migrate

The panel is closed by default. Its routes are registered only when paykit.drivers.manual.panel.ability names a Gate ability, and every request must be a signed-in user who passes it:

Gate::define('manage-payments', fn (User $user) => $user->is_admin);

What the driver refuses on purpose:

  • An amount from the request. Approval ignores amount, amount_minor, currency and status; the stored row is the only source.
  • A second decision. Approving twice raises one event. Approving a rejected payment is refused with a message. So is approving an expired payment that never got a receipt; a payment whose receipt already arrived can still be decided after the window, because a human has the proof in hand.
  • A locked door with no key. A rejected or expired payment can be reopened by a human (ManualPayments::reopen or the panel's Reopen button), so a mistyped reference or a receipt number a stranger attached first does not lock the real customer out. An approved payment is final: reversing one is a refund, which the manual driver does not do.
  • A public receipt. Uploads land on the configured private disk (local by default) and are served only through the panel, only to someone who passes the ability.
  • A fake webhook. verifyAndParseWebhook() on this driver throws: there is no gateway here to trust, and pretending otherwise would be the hole.

Limits, expiry and review tools (v0.2.1)

Everything below is off until you turn it on: nothing is on by default.

  • Limits. methods.{method}.min_minor and max_minor refuse a payment outside the range when it is created.
  • Expiry. Schedule php artisan paykit:manual:expire (for example every five minutes). Overdue payments become expired and raise PaymentFailed. A payment already waiting on a human (awaiting_review) is left alone unless you turn on expire_awaiting_review.
  • One transfer reference, one payment. A reference already attached to a payment is refused on any other (the proof endpoint answers 409). Run the new migration; it adds a unique index on transfer_reference, so clean up duplicate references first if you have them.
  • Several accounts. Give a method accounts (a list of numbers) instead of account; each new payment goes to the one with the fewest open payments.
  • Audit trail (PAYKIT_MANUAL_AUDIT=true). An append-only log in paykit_manual_events (opened, proof submitted, approved, rejected, expired) with who did it. The panel serves it at GET {panel}/{reference}/history.
  • Review alerts. The Paykit\Events\ManualPaymentAwaitingReview event fires when the customer sends proof. Listen to it to send a mail, Slack message or notification. Paykit sends nothing itself.
  • Customer status (PAYKIT_MANUAL_STATUS=true). GET /paykit/manual/{reference}/status returns status, reference, amount and expires_at, so your page can poll. Nothing else: no account, name or phone.
  • Panel extras, each its own switch: panel.search (reference, order, transfer reference, phone, name) and panel.export (CSV; cells that start with =, +, - or @ are neutralised so a customer name cannot run as a formula). The expired filter is always there.
  • InstaPayLink::canonical($link) validates a https://ipn.eg/S/{handle} link strictly. That format comes from third-party descriptions, not from InstaPay, so compare it with a link your own app makes. An InstaPay link does not carry the amount.

Not in this release: automatic confirmation from SMS. Matching a forwarded "you received money" text to a payment (a signed endpoint, a matcher, optional patterns for Vodafone Cash and InstaPay bank texts, unique-amount tagging) was built, then moved out of the release because it has not been checked against a text received on a real phone. It is kept on the branch feature/sms-ingest and will come back after it has been tried on real messages.

Wallets, BNPL, Meeza and InstaPay

None of these is a gateway with its own public merchant API. They are payment methods the four gateways above already expose, so Paykit reaches them the way each gateway documents: an integration ID, an allowed-method string, or whatever your merchant account has enabled.

You want to accept How Paykit does it
Vodafone Cash, Orange Cash, e& money, We Pay, bank wallets Paymob: a Mobile Wallet integration ID in PAYMOB_INTEGRATION_IDS. Kashier: KASHIER_ALLOWED_METHODS=card,wallet.
valU, Souhoola, Forsa, Aman Installments, Sympl, TRU (BNPL) Paymob: one integration ID per provider, enabled on your account. Kashier: KASHIER_ALLOWED_METHODS=bnpl[valu], the same method[provider] syntax as bank_installments[qnb].
Meeza cards Meeza is the Egyptian card scheme, so it rides the card integration of whichever gateway you use. The Fawry driver does not take cards at all.
Meeza wallet / QR Geidea: enable Meeza on your account and it appears on the hosted page; Geidea documents the Meeza QR wallet flow.
InstaPay Ask Paymob or Kashier whether your account has InstaPay enabled, then use the integration ID or allowed method they give you.

Two things worth saying plainly:

  • InstaPay has no public merchant API. It is run by Egyptian Banks Company, onboarding goes through your bank or an acquirer, and the wallet-to-wallet rails are not exposed as a documented HTTP API for third-party merchants.
  • Vodafone Cash and the other wallets are the same story at the source. Access is through an aggregator, a bank or a PSP, not a public developer API. The gateways above are that route.

So Paykit ships no gateway driver for any of them and will not pretend to. Where you have no gateway account at all, the manual driver is the route: a transfer to your own wallet or InstaPay handle, confirmed by a human. If one of these companies publishes a merchant API of its own, a driver is a Paykit\Contracts\Gateway implementation away.

What is not supported yet

Being explicit, so nobody discovers it in production:

  • No Geidea capture. Paymob capture is wrapped for card authorizations. Geidea documents a capture flow but publishes no endpoint recipe for it, so it is not guessed.
  • No saved cards / card tokens. The card-token callback uses a different HMAC field list and is not implemented.
  • Only the POST "transaction processed" callback. The GET "transaction response" callback is not parsed.
  • No capture on Kashier. Refund and void are wrapped; capture is not.
  • No Fawry card or wallet payments. Reference numbers only, for the reasons above.
  • No Geidea voids or saved cards. Refund is wrapped; Geidea documents a void only for pre-authorised, uncaptured payments and publishes no endpoint recipe for it, so it is not guessed.
  • No Viva.com refunds or transaction re-read. Viva documents refunds elsewhere, and its docs point at the webhook fields (order code, transaction id, status, amount) rather than a re-read, which is what the driver checks.
  • No Telr refunds. Telr documents refunds on a different product surface, so the driver takes payments and reads status only rather than claiming a refund path it has not been grounded in.
  • No Xendit payment re-read. Xendit documents a callback token rather than an HMAC for this flow, and the driver does not fetch the payment afterwards; if you want a second look before fulfilling, call Xendit's own API from your application.
  • No Square capture or voids. Square's Payments API can complete a delayed capture; Paykit wraps refunds only, so an APPROVED payment stays pending here.
  • No Klarna capture or order reads. Klarna's Order Management API also captures and reads orders; Paykit wraps refunds only, and the place-order step is left to placeOrder().
  • Null handling in HMAC is a best guess. Paymob does not document how it stringifies a null field. Paykit treats null as an empty string, the PHP default. If a callback with a null signed field ever fails verification, capture the raw payload and check it against Paymob's HMAC troubleshooter.
  • No automatic retries. A timeout surfaces as a GatewayException that says the outcome is unknown. Retry a create-payment call with the same idempotency key; do not blind-retry a refund.

Custom gateways

use Paykit\Facades\Paykit;

Paykit::extend('fawry', fn ($app) => new FawryGateway($app['config']['paykit.drivers.fawry']));

A driver implements Paykit\Contracts\Gateway: name(), createPayment() and verifyAndParseWebhook().

Refunds, voids and captures are separate optional contracts. Implement SupportsRefunds, SupportsVoids or SupportsCapture on your driver and Paykit::refund(), Paykit::void() and Paykit::capture() reach it; a driver that does not implement one keeps raising UnsupportedOperationException for it.

Testing

Testing your own checkout with Paykit::fake()

Your application's tests should not need gateway credentials or a network. Paykit::fake() swaps every driver for a recording stand-in: createPayment answers with a session on a clearly fake URL, refunds, voids and captures answer success, and every call is recorded for assertions.

use Paykit\Facades\Paykit;

it('starts a Paymob payment for a new order', function () {
    $fake = Paykit::fake();

    $this->post('/checkout', ['cart' => 'ORDER-77'])->assertRedirect();

    $fake->assertCreated('paymob', fn ($request) => $request->reference === 'ORDER-77');
});

The fake deliberately refuses to parse webhooks: only the real driver can verify a real signature. Test your webhook handling by posting a recorded fixture to the webhook route, like tests/Feature/WebhookTest.php does.

The package's own suite

composer test        # Pest
composer analyse     # Larastan, level 8, over src
composer format      # Pint
composer check       # all three

The suite runs offline: HTTP is faked and callbacks are recorded fixtures. The HMAC test pins both the concatenated string and the digest, so a change in field order or boolean formatting fails loudly. GitHub Actions runs the same three checks on PHP 8.2, 8.3 and 8.4.

tests/Feature/JourneyTest.php takes it further: it boots mock/gateway.php on port 8137 and drives all four gateways end to end. It creates a payment, pays it on the mock's checkout page, gets back the exact callback the gateway would send (signature included), posts it to the webhook route, asserts the event, and refunds where the gateway supports it. Run the mock by hand with php -S 127.0.0.1:8099 mock/gateway.php and open http://127.0.0.1:8099/; its header lists the env values that point each driver at it. It is a test tool, not a gateway: it holds no account and charges nothing.

docs/sandboxes.md records what each provider publishes about test accounts, test hosts and test card data, and says plainly which parts are still unverified. When something misbehaves, docs/troubleshooting.md lists the problems this package has actually met and what fixed each.

tests/Feature/SecurityAttackTest.php is the attack pass: forged and replayed callbacks, tampered amounts, cross-gateway payloads, hostile URLs, idempotency races, panel authorization and uploads. The threat model it works from is docs/threat-model.md, and what it found, what held and what risk remains is docs/security-audit.md. Run it with vendor/bin/pest --filter=SecurityAttackTest. docs/state-transitions.md is the state-transition table: every state a payment can pass through per driver, and what happens on late, repeated, out-of-order and contradictory callbacks.

Credits

Built by Ahmed Elbanby. Paymob's field order, endpoint and checkout URLs follow Paymob's own documentation:

Kashier, Fawry and Geidea follow their own documentation too:

Which methods each gateway exposes comes from their own pages:

License

MIT. See LICENSE.md.