← Slimpay.ng

Used by every "Try It" panel across these docs to call app.slimpay.ng for real. Get one from Authentication — register or log in, then paste the token here. Stored only in this browser (localStorage), never sent anywhere but the Slimpay API, and auto-cleared after 8 hours.

SDKs

Laravel

Supports Laravel 10, 11 and 12. The package is auto-discovered.

1. Install and publish config

bash
composer require hilinks/slimpay-school-sdk
php artisan vendor:publish --tag=slimpay-config

2. Environment

bash
SLIMPAY_STUDENT_LOOKUP_SECRET=
SLIMPAY_INVOICE_LOOKUP_SECRET=
SLIMPAY_WEBHOOK_SECRET=
SLIMPAY_API_KEY=
SLIMPAY_SCHOOL_ID=SCH-XXXXXXXX

3. Implement your lookups

Create classes implementing StudentLookup / InvoiceLookup (see Lookups), for example in app/Slimpay/, and reference them in config/slimpay.php. They're resolved from the container, so constructor injection works.

php
'student_lookup' => App\Slimpay\Students::class,
'invoice_lookup' => App\Slimpay\Invoices::class,

4. Routes

Registered automatically (set routes.enabled to false to define your own):

Method and pathPaste into Slimpay as
POST /slimpay/student-lookupStudent lookup URL
POST /slimpay/invoice-lookupInvoice lookup URL
POST /slimpay/webhookWebhook URL

Change the prefix or add middleware via routes.prefix and routes.middleware. These are server-to-server calls, so exclude them from CSRF.

Laravel 11/12 (bootstrap/app.php):

php
->withMiddleware(function (Middleware $middleware) {
    $middleware->validateCsrfTokens(except: ['slimpay/*']);
})

Laravel 10 (app/Http/Middleware/VerifyCsrfToken.php):

php
protected $except = ['slimpay/*'];

5. React to payments

In AppServiceProvider::boot():

php
use Slimpay\School\{WebhookHandler, WebhookEvent};

app(WebhookHandler::class)->on('payment.received', function (WebhookEvent $e) {
    if ($e->isTest()) return;
    dispatch(new MarkFeePaid($e->checkoutReference(), $e->studentId(), $e->amount()));
});

Queue the heavy work so the webhook answers within a second or two.

6. Collect an invoice

php
use Slimpay\School\Client;

public function pay(Invoice $invoice, Client $slimpay)
{
    $checkout = $slimpay->collectInvoice(config('slimpay.school_id'), $invoice->number, route('payments.return'));
    return redirect()->away($checkout->url);
}
Behind a proxy or load balancer

Signature verification uses the raw request body. Make sure nothing rewrites it before Laravel (some WAFs or JSON-normalising middleware do), and that your server clock is accurate.

Config reference

KeyDefaultPurpose
student_lookup_secretenv SLIMPAY_STUDENT_LOOKUP_SECRETVerifies student lookups
invoice_lookup_secretenv SLIMPAY_INVOICE_LOOKUP_SECRETVerifies invoice lookups
webhook_secretenv SLIMPAY_WEBHOOK_SECRETVerifies webhooks (optional while unsigned)
student_lookup / invoice_lookupnullYour implementing classes
api_key, school_id, base_urlenvClient settings
tolerance300Allowed clock skew in seconds
routes.enabled / prefix / middlewaretrue / slimpay / []Route registration