Laravel Package
This package enables seamless integration with the Paylink payment gateway within Laravel applications. and provides convenient methods to interact with the Paylink API, facilitating payment processing and related functionalities.
Package Page:
https://packagist.org/packages/paylinksa/laravel
Installation
You can install the paylinksa/laravel
package via composer. Run the following command in your terminal:
composer require paylinksa/laravel
Payment Service
Environment Setup
Create an instance of PaylinkService
based on your environment
- For Testing
use Paylink\Services\PaylinkService;
$paylinkService = PaylinkService::test();
- For Production
use Paylink\Services\PaylinkService;
$paylinkService = PaylinkService::production('API_ID_xxxxxxxxxx', 'SECRET_KEY_xxxxxxxxxx');
Methods
-
Add Invoice:
Add an invoice to the system for payment processing.
use Paylink\Models\PaylinkProduct; $invoiceDetails = $paylinkService->addInvoice( amount: 250.0, clientMobile: '0512345678', clientName: 'Mohammed Ali', orderNumber: '123456789', products: [ new PaylinkProduct(title: 'item1', price: 5.0, qty: 10), new PaylinkProduct(title: 'item2', price: 20.0, qty: 10) ], callBackUrl: 'https://example.com', );
-
Get Invoice
Retrieve invoice details.
$invoiceDetails = $paylinkService->getInvoice(transactionNo: '1714289084591'); // $invoiceDetails->orderStatus; // $invoiceDetails->transactionNo; // $invoiceDetails->url; // ...
-
Cancel Invoice
Cancel an existing invoice initiated by the merchant.
$paylinkService->cancelInvoice(transactionNo: '1714289084591'); // true-false
Updated about 2 months ago