imransaleem / telenor-integration
A Laravel package for integrating with Telenor APIs.
v1.0.0
2025-08-02 11:34 UTC
Requires
- php: >=7.4
- illuminate/support: ^8.0|^9.0|^10.0
README
A Laravel package for integrating with Telenor APIs, supporting login, inquiry, and fund transfer via CNIC.
Features
- Corporate login using encrypted payload
- Balance inquiry by CNIC
- Fund transfer to CNIC/MSISDN
- Automatic request logging to database
Installation
composer require imransaleem/telenor-integration
If you're not using Laravel package auto-discovery, add the service provider and alias manually:
config/app.php
'providers' => [ ImranSaleem\TelenorIntegration\TelenorIntegrationServiceProvider::class, ], 'aliases' => [ 'Telenor' => ImranSaleem\TelenorIntegration\Facades\Telenor::class, ],
Configuration
Publish the config file:
php artisan vendor:publish --tag=telenor-config
Then update your .env
:
TELENOR_BASE_URL=https://api.telenor.com.pk TELENOR_MSISDN=92300xxxxxxx TELENOR_CLIENT_ID=your-client-id TELENOR_CLIENT_SECRET=your-client-secret TELENOR_LOGIN_CREDENTIALS=92300xxxxxxx:password
Keys
Place your RSA keys in the following paths:
storage/app/keys/private.pem
storage/app/keys/subgateway.pem
Migrations
Run the migration to create the API log table:
php artisan migrate
Usage
Login
$login = Telenor::login();
Inquiry
if ($login['ResponseCode'] === '0') { $inquiry = Telenor::inquiry( $login['Timestamp'], $beneficiary, // object with contact_number and cnic $amount // amount to disburse ); }
Transfer
if ($inquiry['ResponseCode'] === '0') { $transfer = Telenor::transfer( $login['Timestamp'], $beneficiary, $amount ); }
Logging
All API requests are logged in the telenor_api_logs
table automatically.
License
MIT © Imran Saleem