PHP code example of paylinksa / laravel

1. Go to this page and download the library: Download paylinksa/laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

paylinksa / laravel example snippets


use Paylink\Services\PaylinkService;

$paylinkService = PaylinkService::test();

use Paylink\Services\PaylinkService;

$paylinkService = PaylinkService::production('API_ID_xxxxxxxxxx', 'SECRET_KEY_xxxxxxxxxx');

      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',
      );
   

      $invoiceDetails = $paylinkService->getInvoice(transactionNo: '1714289084591');

      // $invoiceDetails->orderStatus;
      // $invoiceDetails->transactionNo;
      // $invoiceDetails->url;
      // ...
   

      $paylinkService->cancelInvoice(transactionNo: '1714289084591'); // true-false
   

use Paylink\Services\PartnerService;

$partnerService = PartnerService::test('profileNo_xxxxxxxxxxx', 'apiKey_xxxxxxxxxxxx');

use Paylink\Services\PartnerService;

$partnerService = PartnerService::production('profileNo_xxxxxxxxxxx', 'apiKey_xxxxxxxxxxxx');

      $responseData = $partnerService->checkLicense(
         registrationType: "cr", // freelancer or cr
         licenseNumber: "7014832310",
         mobileNumber: "0512345678",
         hijriYear: "1400",
         hijriMonth: "06",
         hijriDay: "16",
         partnerProfileNo: "07537924"
      );
   

      $responseData = $partnerService->validateMobile(
         signature: "ae135f2506dc3c44152d62265419c09e80dec0b108090bc81d6a1a691c3f0647",
         mobile: "0512345678",
         sessionUuid: "96ea8e22-edef-414b-9724-3bd2d494b710",
         otp: "7615",
         partnerProfileNo: "19039481"
      );
   

      $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: "[email protected]",
         firstName: "Mohammed",
         lastName: "Ali",
         password: "xxxxxxxxxxx",
      );
   

      $responseData = $partnerService->confirmingWithNafath(
         signature: 'ae135f2506dc3c44152d62265419c09e80dec0b108090bc81d6a1a691c3f0647',
         sessionUuid: '96ea8e22-edef-414b-9724-3bd2d494b710',
         mobile: '0512345678',
         partnerProfileNo: '19039481',
      );
   

      $responseData = $partnerService->getMyMerchants();
   

      $responseData = $partnerService->getMerchantKeys(
         searchType: 'cr', // cr, freelancer, mobile, email, accountNo
         searchValue: '20139202930',
         profileNo: '12345687',
      );