Download the PHP package paynecta/paynecta-laravel-sdk without Composer
On this page you can find all versions of the php package paynecta/paynecta-laravel-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download paynecta/paynecta-laravel-sdk
More information about paynecta/paynecta-laravel-sdk
Files in paynecta/paynecta-laravel-sdk
Package paynecta-laravel-sdk
Short Description Official Laravel SDK for Paynecta Payment API - Simplify M-Pesa, Bank, and Wallet payment integrations in Kenya
License MIT
Informations about the package paynecta-laravel-sdk
Paynecta Laravel SDK
Official Laravel SDK for Paynecta Payment API - Simplify M-Pesa, Bank, and Wallet payment integrations in Kenya.
Features
- 🚀 Easy Integration - Get started in minutes with simple configuration
- 💳 M-Pesa STK Push - Trigger payment prompts directly on customer phones
- 💰 Payment Links - Create and manage shareable payment pages
- 🏦 Bank Integration - Access all available banks and their paybill numbers
- 🔔 Real-time Webhooks - Instant notifications for payment events
- 🛡️ Secure Authentication - API key and email-based authentication
- 📝 Comprehensive Logging - Debug with detailed request/response logs
- ⚡ Exception Handling - Graceful error handling with specific exceptions
- 🎯 Laravel Events - Native Laravel event system for webhooks
Requirements
- PHP 8.1 or higher
- Laravel 10.x or 11.x
- Guzzle HTTP Client 7.x
Installation
Install the package via Composer:
Publish Configuration
Publish the configuration file to customize settings:
This will create a config/paynecta.php file in your Laravel application.
Environment Configuration
Add your Paynecta credentials to your .env file:
⚠️ Security Note: Never commit your API credentials to version control. Always use environment variables.
Getting Your API Credentials
- Log in to your Paynecta Dashboard
- Navigate to
/apisection - Click "Create New API Key"
- Copy your API key immediately (it's shown only once!)
- Store it securely in your
.envfile
Quick Start
Verify Authentication
Test your credentials and retrieve user information:
Usage Guide
1. Payment Links
2. Initialize Payments (M-Pesa STK Push)
3. Query Payment Status
4. Currency Rates
5. Banks
6. Webhooks
Setup Webhook URL
Your webhook URL will be automatically registered at:
Add to your dashboard at: https://paynecta.co.ke
Whitelist Webhook Route (Important!)
Add to app/Http/Middleware/VerifyCsrfToken.php:
Listen to Webhook Events
Create event listeners:
In app/Listeners/HandlePaymentCompleted.php:
Register in app/Providers/EventServiceProvider.php:
Complete Payment Flow Example
Configuration Options
The package uses the following configuration options (in config/paynecta.php):
Advanced Usage
Dependency Injection
Custom Timeout
Enable Logging
Custom Base URL (Testing)
Exception Handling
The SDK throws specific exceptions for different error types:
Exception Methods
All Paynecta exceptions provide these methods:
Testing
Testing Webhooks Locally
Use ngrok to expose your local server:
Copy the HTTPS URL and add to your Paynecta dashboard:
Manual Testing
API Reference
Authentication
verifyAuth()- Verify API credentials and get user info
Payment Links
paymentLinks()->getAll()- Get all payment linkspaymentLinks()->get($code)- Get specific linkpaymentLinks()->getInvoices()- Get invoice links onlypaymentLinks()->getRegularLinks()- Get non-invoice linkspaymentLinks()->search($term)- Search linkspaymentLinks()->count()- Get total count
Payments
payments()->initialize($code, $mobile, $amount)- Initialize STK pushpayments()->initializeWithValidation($code, $mobile, $amount)- Initialize with validationpayments()->queryStatus($reference)- Query payment statuspayments()->pollStatus($reference, $maxAttempts, $sleepSeconds)- Poll until completepayments()->isCompleted($response)- Check if completedpayments()->isPending($response)- Check if pendingpayments()->isFailed($response)- Check if failedpayments()->getMpesaReceiptNumber($response)- Get receipt numberpayments()->getFailureReason($response)- Get failure reason
Banks
banks()->getAll()- Get all banksbanks()->get($bankId)- Get specific bankbanks()->search($term)- Search banksbanks()->findByName($name)- Find by exact namebanks()->findByPaybill($paybill)- Find by paybill numberbanks()->getForDropdown()- Get for select dropdownbanks()->getAllAsList()- Get as simple listbanks()->getGroupedByLetter()- Get grouped by first letter
Currency Rates
currencyRates()->getAll()- Get all currency rates (160+ currencies)currencyRates()->get($currency)- Get specific currency ratecurrencyRates()->convert($amount, $from, $to, $date)- Convert currency amountscurrencyRates()->getHistory($from, $to, $startDate, $endDate)- Get historical ratescurrencyRates()->getRate($response)- Extract rate from responsecurrencyRates()->getConvertedAmount($response)- Extract converted amountcurrencyRates()->getRates($response)- Extract rates array
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Paynecta
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Support
- 📧 Email: [email protected]
- 🌐 Website: https://paynecta.co.ke
- 📖 Documentation: https://paynecta.co.ke/docs
- 💬 Support: https://paynecta.co.ke/support
Made with ❤️ by Paynecta
All versions of paynecta-laravel-sdk with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0