PHP School SDK
The School SDK connects your school's system (student portal, fee system, ERP) to Slimpay without hand-writing signature checks or payload parsing. The core is plain PHP 8.1+ with no runtime dependencies, so it works in Laravel, Symfony, CodeIgniter, Slim or a single index.php.
Install
composer require hilinks/slimpay-school-sdk
Requires PHP 8.1+ and ext-json. ext-curl is needed if you use Client. Your endpoints must be public HTTPS URLs — Slimpay won't call loopback, private or non-HTTPS addresses, so use a tunnel such as ngrok for local development.
What it does
| You want to… | Use |
|---|---|
| Confirm a student ID while a parent pays | LookupHandler::handleStudent() |
| Let Slimpay fetch an invoice's amount and student | LookupHandler::handleInvoice() |
| Get notified when a payment lands | WebhookHandler |
| Start a payment for an invoice from your own portal | Client::collectInvoice() |
| Plug all of this into Laravel | SlimpayServiceProvider |
Secrets
Four credentials are issued in your school portal. Each is shown once — store them in environment variables, never in git.
| Secret | Where to get it | Used for |
|---|---|---|
| Student lookup secret | Settings → Student Lookup | Verifying student lookup requests |
| Invoice lookup secret | Settings → Invoice Collection | Verifying invoice lookup requests |
| Webhook secret | Webhooks → Signing secret | Verifying payment webhooks |
| API key (sandbox / live) | Settings → API Keys | Calling Slimpay with Client |
Quick tour
use Slimpay\School\{Client, LookupHandler, WebhookHandler, WebhookEvent};
// 1. Slimpay asks YOUR system about a student (signed request, you answer).
$lookups = new LookupHandler($studentSecret, new MyStudents());
echo json_encode($lookups->handleStudent(file_get_contents('php://input'), getallheaders()));
// 2. Slimpay tells YOU a payment arrived.
(new WebhookHandler($webhookSecret))
->on('payment.received', fn (WebhookEvent $e) => markPaid($e->studentId(), $e->amount()))
->handle(file_get_contents('php://input'), getallheaders());
// 3. YOU ask Slimpay to collect an invoice.
$checkout = (new Client($apiKey))->collectInvoice('SCH-9K2H7XQZ', 'INV-8841', 'https://portal.example.edu.ng/return');
header('Location: ' . $checkout->url);
Lookups
Slimpay calls your server with a signed request when a parent types a student ID on checkout (student lookup) or when your portal calls collectInvoice() (invoice lookup). See Lookups.
Webhooks
WebhookHandler verifies the signature and dispatches payment.received to your listeners. See Webhooks.
Collect an invoice
See API Client.
Framework guides
Laravel is auto-discovered with routes provided — see Laravel. For Symfony, Slim, CodeIgniter, WordPress or plain PHP, see Other Frameworks.
Going live
- Register your public URLs in the school portal and enable lookups.
- Use Send Test Webhook on the Webhooks page and Test Connection in Settings.
- Make a small sandbox payment end to end.
- Swap the sandbox API key for the live key and confirm secrets are in your production environment.
See Testing, Security and Troubleshooting. Keep your server clock accurate (NTP): signed requests older than 5 minutes are rejected.
docs