PHP SDK for Lenco API - Payments, Transfers, Collections
composer require alexasomba/lenco-php<?php
use Lenco\Client;
$lenco = new Client([
'api_key' => getenv('LENCO_API_KEY'),
'environment' => 'production', // or 'sandbox'
]);
// Get accounts
$accounts = $lenco->accounts->list();
// Transfer to bank account
$transfer = $lenco->transfers->toBankAccount([
'accountId' => 'your-account-uuid',
'accountNumber' => '0123456789',
'bankId' => 'bank-uuid',
'amount' => 10000,
'reference' => 'payment-001',
'narration' => 'Payment for services',
]);
// Collect via mobile money
$collection = $lenco->collections->fromMobileMoney([
'amount' => 5000,
'reference' => 'order-123',
'phone' => '0971234567',
'operator' => 'airtel',
'country' => 'zm',
]);// config/services.php
'lenco' => [
'key' => env('LENCO_API_KEY'),
'environment' => env('LENCO_ENVIRONMENT', 'production'),
],
// app/Providers/AppServiceProvider.php
use Lenco\Client;
public function register()
{
$this->app->singleton(Client::class, function ($app) {
return new Client([
'api_key' => config('services.lenco.key'),
'environment' => config('services.lenco.environment'),
]);
});
}- Full PHP 8.1+ support
- Accounts, Banks, Transfers, Collections, Settlements, Transactions APIs
- Webhook signature verification
- Automatic retries with exponential backoff
- Laravel service provider included
Full API documentation available at docs.lenco.co
Alexander Asomba (@alexasomba) · 𝕏 @alexasomba
MIT