bhekor / laravel-opay
A Laravel package for integrating OPay Checkout payment APIs
v1.0.0
2026-11-12 11:25 UTC
Requires
- php: ^8.2
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- illuminate/http: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Reusable Laravel package for OPay Checkout APIs.
Features
- Cashier create / status (preferred wallet flow:
OpayWalletNg+evokeOpay) - Direct payment create (including
OpayWalletNgQR) - Refund create
- HMAC-SHA512 request signing
- HMAC-SHA3-512 callback verification
- Sandbox and live environments
This package does not contain host wallet, customer, or transaction business logic.
Installation
composer require bhekor/laravel-opay
Laravel discovers the service provider and Opay facade automatically. Publishing the config is optional; it creates config/opay.php so you can override package defaults.
php artisan vendor:publish --tag=opay-config
Configuration
| Env | Description |
|---|---|
OPAY_BASE_URL |
API host — sandbox https://testapi.opaycheckout.com or live https://liveapi.opaycheckout.com |
OPAY_MERCHANT_ID |
Merchant ID |
OPAY_PUBLIC_KEY |
Public key (cashier create) |
OPAY_SECRET_KEY |
Secret key (status / refund / callbacks) |
OPAY_DEFAULT_PAY_METHOD |
Default OpayWalletNg |
OPAY_EVOKE_OPAY |
Default true |
OPAY_TIMEOUT |
HTTP request timeout in seconds — default 60 |
OPAY_COUNTRY |
Default country — NG |
OPAY_CURRENCY |
Default currency — NGN |
OPAY_EXPIRE_AT_MINUTES |
Cashier session expiry — default 30 |
Environment is implied by the base URL and which keys you configure (no OPAY_ENV flag).
Usage
use Bhekor\LaravelOpay\Facades\Opay; use Bhekor\LaravelOpay\Support\Money; $result = Opay::cashier()->create([ 'country' => 'NG', 'reference' => $merchantReference, 'amount' => [ 'total' => Money::toMinor(1500), 'currency' => 'NGN', ], 'returnUrl' => $returnUrl, 'callbackUrl' => $webhookUrl, 'cancelUrl' => $cancelUrl, 'payMethod' => 'OpayWalletNg', 'evokeOpay' => true, 'customerVisitSource' => 'BROWSER', // IOS | ANDROID | BROWSER 'product' => [ 'name' => 'Wallet top-up', 'description' => 'Utilify Networks', ], ]); $cashierUrl = $result->cashierUrl; $status = Opay::cashier()->status([ 'country' => 'NG', 'reference' => $merchantReference, ]); $callback = Opay::webhooks()->parse($request->all());
See MERCHANT_ONBOARDING.md for go-live checklist.
Tests
composer install
composer test
License
MIT