paylinksa / laravel
Paylink package for integrating with Paylink gateway.
README
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.
Installation
You can install the paylinksa/laravel
package via composer. Run the following command in your terminal:
composer require paylinksa/laravel
Package Integration
After installing the package, you need to add the Paylink service provider to your Laravel application configuration.
-
Open your Laravel application's
config/app.php
file. -
Add the following line to the
providers
array:'providers' => [ // Other Service Providers... Paylink\PaylinkServiceProvider::class, ],
Merchant Service
Environment Setup
- Add the following environment variables to your
.env
file:
# PRODUCTION ENVIRONMENT: PAYLINK_PRODUCTION_API_ID=[your_production_api_id] PAYLINK_PRODUCTION_SECRET_KEY=[your_production_secret_key] PAYLINK_PRODUCTION_PERSIST_TOKEN=false
-
Replace placeholders as following:
[your_production_api_id]
=>API ID
[your_production_secret_key]
=>API Secret Key
API ID
andAPI Secret Key
can be obtained from MY PAYLINK PORTAL->SETTINGS.
Methods
-
Add Invoice:
Add an invoice to the system for payment processing.
$merchantService = new MerchantService(); $invoiceDetails = $merchantService->addInvoice( amount: 170.0, clientMobile: '0512345678', clientName: 'Mohammed Ali', orderNumber: '123456789', products: $products, callBackUrl: 'https://example.com', );
-
Get Invoice
Retrieve invoice details.
$merchantService = new MerchantService(); $invoiceDetails = $merchantService->getInvoice(transactionNo: '1714289084591');
-
Cancel Invoice
Cancel an existing invoice initiated by the merchant.
$merchantService = new MerchantService(); $merchantService->cancelInvoice(transactionNo: '1714289084591');
Examples:
- Merchant Examples
- Payment Webhook (used by merchants)
For detailed usage instructions, refer to the Merchant Services
Partner Service
Environment Setup
- Add the following environment variables to your
.env
file:
# TESTING ENVIRONMENT: PAYLINK_TESTING_PROFILE_NO=[your_profile_no_for_testing] PAYLINK_TESTING_API_KEY=[your_api_key_for_testing] PAYLINK_TESTING_PERSIST_TOKEN=false # PRODUCTION ENVIRONMENT: PAYLINK_PRODUCTION_PROFILE_NO=[your_profile_no_for_production] PAYLINK_PRODUCTION_API_KEY=[your_api_key_for_production] PAYLINK_PRODUCTION_PERSIST_TOKEN=false
-
Replace placeholders as following:
[your_profile_no_for_testing]
=>Profile No
[your_api_key_for_testing]
=>API Key
[your_profile_no_for_production]
=>Profile No
[your_api_key_for_production]
=>API Key
Profile No
andAPI Key
can be obtained from MY PAYLINK PORTAL->SETTINGS.
Methods
-
Check License
Initiates the first step of the registration process by checking the merchant's license information.
$partnerService = new PartnerService(); $responseData = $partnerService->checkLicense( registrationType: "cr", // freelancer or cr licenseNumber: "7014832310", mobileNumber: "0512345678", hijriYear: "1400", hijriMonth: "06", hijriDay: "16", partnerProfileNo: "07537924" );
-
Validate Mobile
Validates the merchant's mobile number by confirming the OTP received via SMS.
$partnerService = new PartnerService(); $responseData = $partnerService->validateMobile( signature: "ae135f2506dc3c44152d62265419c09e80dec0b108090bc81d6a1a691c3f0647", mobile: "0512345678", sessionUuid: "96ea8e22-edef-414b-9724-3bd2d494b710", otp: "7615", partnerProfileNo: "19039481" );
-
Add Information
Adds information related to the merchant, such as bank details, business category, and personal information.
$partnerService = new PartnerService(); $responseData = $partnerService->addInfo( mobile: "0500000001", sessionUuid: "96ea8e22-edef-414b-9724-3bd2d494b710", signature: "ae135f2506dc3c44152d62265419c09e80dec0b108090bc81d6a1a691c3f0647", partnerProfileNo: "19039481", iban: "SA1231231231312312313213", bankName: "AlRajhi Bank", categoryDescription: "Any description for the activity of the merchant. It must match the activity of the merchant.", salesVolume: "below_10000", sellingScope: "domestic", nationalId: "1006170383", licenseName: '21012451525', email: "mohammed@test.com", firstName: "Mohammed", lastName: "Ali", password: "xxxxxxxxxxx", );
-
Confirming Account with Nafath
Confirms the account with Nafath after submitting the required information.
$partnerService = new PartnerService(); $responseData = $partnerService->confirmingWithNafath( signature: 'ae135f2506dc3c44152d62265419c09e80dec0b108090bc81d6a1a691c3f0647', sessionUuid: '96ea8e22-edef-414b-9724-3bd2d494b710', mobile: '0512345678', partnerProfileNo: '19039481', );
-
Get My Merchants
Retrieves a list of merchants associated with the partner's account.
$partnerService = new PartnerService(); $responseData = $partnerService->getMyMerchants();
-
Get Merchant Keys
Retrieves API credentials (API ID and Secret Key) for a specific sub-merchant.
$partnerService = new PartnerService(); $responseData = $partnerService->getMerchantKeys( searchType: 'cr', // cr, freelancer, mobile, email, accountNo searchValue: '20139202930', profileNo: '12345687', );
Examples:
- Partner Examples
- Activation Webhook (used by partners)
For detailed usage instructions, refer to the Partner Service
Support
If you encounter any issues or have questions about the Paylink Package, please contact us.
License
This package is open-source software licensed under the MIT license.