A Laravel package for BNP Paribas Axepta payment gateway integration.
Install the package via composer:
composer require tlm/laravel-axepta
Publish the configuration file:
php artisan vendor:publish --tag=axepta-config
Add the following environment variables to your .env
file:
AXEPTA_API_URL=https://paymentpage.axepta.bnpparibas/paymentpage.aspx
AXEPTA_MERCHANT_ID=your-merchant-id
AXEPTA_BLOWFISH_KEY=your-blowfish-key
AXEPTA_HMAC_KEY=your-hmac-key
AXEPTA_TEST_MODE=true
AXEPTA_DEFAULT_CURRENCY=EUR
use TLM\LaravelAxepta\Facades\Axepta;
use TLM\LaravelAxepta\Data\PaymentData;
$paymentData = new PaymentData(
transactionId: 'TXN123',
amount: 99.99,
notifyUrl: route('payment.notify'),
successUrl: route('payment.success'),
failureUrl: route('payment.failure'),
currency: 'EUR',
customerEmail: 'customer@example.com',
orderDescription: 'Order #123'
);
$paymentUrl = Axepta::createHostedPaymentPageUrl($paymentData);
// Redirect user to payment page
return redirect($paymentUrl);
Create a route to handle payment notifications:
Route::post('/payment/notify', function (Request $request) {
$isValid = Axepta::validatePaymentNotification($request->all());
if ($isValid) {
$status = $request->input('Status');
$transactionId = $request->input('TransID');
if ($status === 'SUCCESS') {
// Payment successful - update your database
// Update order status, send confirmation emails, etc.
} else {
// Payment failed - handle accordingly
}
return response()->json(['status' => 'success'], 200);
}
return response()->json(['status' => 'error'], 400);
})->name('payment.notify');
Route::get('/payment/success', function (Request $request) {
// Handle successful payment
return view('payment.success');
})->name('payment.success');
Route::get('/payment/failure', function (Request $request) {
// Handle failed payment
return view('payment.failure');
})->name('payment.failure');
$paymentData = PaymentData::fromArray([
'transaction_id' => 'TXN123',
'amount' => 99.99,
'notify_url' => route('payment.notify'),
'success_url' => route('payment.success'),
'failure_url' => route('payment.failure'),
'currency' => 'EUR',
'customer_email' => 'customer@example.com',
'order_description' => 'Order #123',
'is_test' => false,
]);
The package supports the following configuration options:
api_url
- Axepta API endpoint URLmerchant_id
- Your merchant ID provided by BNP Paribasblowfish_key
- Blowfish encryption keyhmac_key
- HMAC signature keytest_mode
- Enable/disable test modedefault_currency
- Default currency (EUR)message_version
- API message version (2.0)
- All payment data is encrypted using Blowfish encryption
- HMAC signatures are used to verify payment notifications
- Sensitive configuration data should be stored in environment variables
composer test
Please see CONTRIBUTING for details.
If you discover a security vulnerability, please send an e-mail to lmtahirou@gmail.com .
The MIT License (MIT). Please see License File for more information.