bornmt / laravel-apcopay
Laravel integration for ApcoPay payment gateway (hosted page and payment status)
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/bornmt/laravel-apcopay
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- phpunit/phpunit: ^10.0|^11.0
This package is auto-updated.
Last update: 2026-02-05 05:50:46 UTC
README
Laravel integration for the ApcoPay payment gateway: hosted payment page and payment status (GetPayment / PreparePayment).
Requirements
- PHP 8.2+
- Laravel 10.x, 11.x or 12.x
- GuzzleHTTP 7.x
Installation
composer require bornmt/laravel-apcopay
Publish the config file (optional; defaults are used from the package):
php artisan vendor:publish --tag=apcopay-config
Configuration
Add to your .env:
APCO_PAY_ENV=local APCO_PAY_USERNAME= APCO_PAY_PASSWORD= APCO_PAY_PID= APCOPAY_BASE_URL=https://www.apsp.biz/GPG/RESTAPI/api/OnlinePayments APCOPAY_SANDBOX_BASE_URL=https://www.apsp.biz/GPGTest/RESTAPI/api/OnlinePayments
Set APCO_PAY_ENV=production for live payments.
Usage
Inject BornMT\ApcoPay\Contracts\ApcoPayServiceInterface:
use BornMT\ApcoPay\Contracts\ApcoPayServiceInterface; use BornMT\ApcoPay\Enums\PaymentStateFields; // Get hosted page URL for redirect $response = $apcoPay->getHostedPage( sessionReference: $sessionReference, amount: $amount, returnUrl: $returnUrl ); $paymentUrl = $response['paymentURLField']; // Get payment status $payment = $apcoPay->getPayment($sessionReference); // Get payment with retries (e.g. while processing) $payment = $apcoPay->getPaymentWithRetry($sessionReference, 3); // Check state PaymentStateFields::CANCELLED->value; // 2 PaymentStateFields::SUCCESS->value; // 3 PaymentStateFields::FAILED->value; // 4
Exceptions: the service throws BornMT\ApcoPay\Exceptions\ApcoPayException on API or retry failures.
License
The MIT License (MIT). Please see the License File for more information.