LaravelPackages.net
Acme Inc.
Toggle sidebar
paymint/paymint-laravel

The official Laravel wrapper for PayMint Africa

60
0
v1.0.1
About paymint/paymint-laravel

paymint/paymint-laravel is a Laravel package for the official laravel wrapper for paymint africa. It currently has 0 GitHub stars and 60 downloads on Packagist (latest version v1.0.1). Install it with composer require paymint/paymint-laravel. Discover more Laravel packages by paymint or browse all Laravel packages to compare alternatives.

Last updated

PayMint Africa Laravel SDK

The official Laravel wrapper for PayMint Africa. Seamlessly integrate PayMint into your Laravel application with zero configuration and elegant syntax.

Installation

Install the package via Composer:

composer require paymint/paymint-laravel

Configuration

Add your PayMint API keys to your .env file:

PAYMINT_SECRET_KEY=sk_live_your_secret_key # Optional: Set a custom base URL for testing or sandbox # PAYMINT_BASE_URL=https://sandbox.api.paymint.africa/v1/

That's it! The package will automatically load your configuration. You do not need to publish any config files.

Usage

Use the elegant PayMint Facade to interact with the API anywhere in your application.

use PayMint\Laravel\Facades\PayMint;

// Create a Virtual Account
$account = PayMint::virtualAccounts()->create([
    'name' => 'Jane Doe',
    'email' => '[email protected]',
    'phone' => '08123456789'
]);

return response()->json($account);

Webhook Verification

Verify incoming webhooks directly inside your Laravel controllers or routes to ensure the payload is securely coming from PayMint.

use Illuminate\Http\Request;
use PayMint\Laravel\Facades\PayMint;
use Illuminate\Support\Facades\Route;

Route::post('/webhook/paymint', function (Request $request) {
    // 1. Get raw payload and signature
    $payload = $request->getContent();
    $signature = $request->header('X-Paymint-Signature');

    // 2. Verify securely
    if (!PayMint::webhooks()->verifySignature($payload, $signature)) {
        return response()->json(['error' => 'Invalid signature detected.'], 401);
    }

    // 3. Process webhook safely!
    $event = $request->input('event');
    
    if ($event === 'payment.success') {
        // Credit the customer's wallet here...
    }

    return response()->json(['status' => 'success']);
});

License

MIT License