OPay¶
OPay's driver supports hosted one-time payments, bank transfers, virtual accounts, and balance queries. Request signing is handled internally using the configured private key.
Setup¶
OPAY_PRIVATE_KEY=your_private_key
OPAY_PUBLIC_KEY=your_public_key
OPAY_MERCHANT_ID=your_merchant_id
OPAY_BASE_URL=https://live.opayng.com
OPAY_CALLBACK_URL=https://example.com/payment/callback
OPAY_WEBHOOK_SECRET=your_webhook_secret
Use the sandbox API base URL and credentials supplied for testing. Keep signing credentials server-side. The driver sends the merchant ID and an HMAC-SHA512 request hash in its authentication headers.
Hosted checkout¶
use Alphabalex\PaymentMadeEasy\Facades\Payment;
$driver = Payment::driver('opay');
$checkout = $driver->initializePayment([
'email' => 'customer@example.com',
'amount' => 5000.00,
'currency' => 'NGN',
'reference' => 'ORDER_123',
'callback_url' => 'https://example.com/payment/callback',
'payment_method'=> 'Card',
]);
// Redirect to the checkout URL returned by OPay.
$payment = $driver->verifyPayment('ORDER_123');
Supported payment method values depend on your OPay integration; the driver defaults to Card and accepts methods such as bank transfer, bank account, OPay wallet, or bank USSD where enabled. Amounts use major units.
Payouts, virtual accounts, and balance¶
The driver implements the shared disbursement, virtual-account, and balance interfaces. Bank payouts require a bank code, account number, amount, currency, and reference. It also exposes provider-specific beneficiary and wallet-statement operations.
$driver->transfer([
'amount' => 5000.00, 'currency' => 'NGN',
'account_number' => '0123456789', 'bank_code' => '044',
'reference' => 'PAYOUT_123', 'reason' => 'Customer refund',
]);
$balance = $driver->getBalance('NGN');
For virtual-account identity requirements, transfer status checks, and full response examples, use the API reference. OPay does not implement the shared subscription or payment-link interfaces.
Webhooks¶
Register POST /webhooks/payment-gateways/opay and configure the webhook secret. Verify webhook signatures and reconcile payment status before fulfilment. See webhook security.
See OPay in the API reference. Related: payments · configuration · gateway directory.