payxy/laravel-payment-checkout

Laravel SDK for Payxy Payment Gateway

Maintainers

Package info

github.com/Proximaforte/payxy-laravel-checkout

pkg:composer/payxy/laravel-payment-checkout

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.2 2026-03-03 18:41 UTC

This package is auto-updated.

Last update: 2026-03-31 18:48:49 UTC


README

A lightweight and easy-to-use Laravel SDK for integrating the Payxy Payment Gateway. This package supports Card, Bank Transfer, and USSD payments, including a pre-built Blade component for seamless checkout.

Installation

You can install the package via composer:

composer require payxy/laravel-checkout

The package will automatically register its service provider and facade.

Configuration

Publish the configuration file to your project:

php artisan vendor:publish --tag="payxy-config"

This will create a config/payxy.php file. You should then add your Payxy credentials to your .env file:

PAYXY_BASE_URL=https://api.payxy.africa
PAYXY_API_TOKEN=your_api_token_here
PAYXY_PUBLIC_KEY=your_public_key_here

Usage

1. Frontend Checkout (Blade Component)

To use the inline checkout, simply drop the <x-payxy-checkout /> component into your Blade view.

<x-payxy-checkout 
    :reference="'TXN_' . time()" 
    :amount="5000" 
    :email="'customer@example.com'" 
/>

2. Backend API (Facade)

You can use the Payxy facade to interact with the API directly for server-side payment initialization or bank lists.

Get USSD Banks

use Payxy\Checkout\Facades\Payxy;

$banks = Payxy::getUSSDBanks();

Initiate Bank Transfer or USSD Payment

use Payxy\Checkout\Facades\Payxy;

$paymentInfo = [
    'reference' => 'TXN_123456',
    'amount' => 5000,
    'email' => 'customer@example.com',
    'callbackUrl' => route('payment.callback'),
];

// For USSD
$response = Payxy::initiatePayment($paymentInfo, 'USSD', '058'); // 058 is GTBank code

// For Bank Transfer
$response = Payxy::initiatePayment($paymentInfo, 'BANK_TRANSFER');

Verify Webhook Signature

Ensure your webhook endpoints are secure by verifying the signature:

use Payxy\Checkout\Facades\Payxy;

$payload = $request->getContent();
$signature = $request->header('X-Payxy-Signature');
$secret = config('payxy.api_token');

if (Payxy::verifyWebhook($payload, $signature, $secret)) {
    // Valid request, process the payment
}

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.