PHP code example of yosefib / sadad-pgw

1. Go to this page and download the library: Download yosefib/sadad-pgw 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/ */

    

yosefib / sadad-pgw example snippets


return [
    'base_url' => env('SADAD_BASE_URL'),
    'token' => env('SADAD_TOKEN'),
];

use YosefIb\SadadPGW\Sadad;

public function initiate(Sadad $sadad)
{
    $response = $sadad->validateCustomer(
        '0921234567',  // Customer phone number
        '1990',        // Birth year as string
        'INV-1001',    // Invoice number
        75.00,         // Amount
        7              // Service category (example: Food & Beverages)
    );

    return response()->json($response);
}

$response = $sadad->validateCustomer(
    '0921234567', // Customer phone number
    1990,         // Birth year
    'INV-1001',   // Invoice number
    75.00,        // Amount
    7             // Service category (example: Food & Beverages)
);

$response = $sadad->payInvoice(
    'TransactionId_From_ValidateCustomer',
    'OTP_Code_From_SMS'
);

$response = $sadad->resendOtp(
    'TransactionId_From_ValidateCustomer'
);

$response = $sadad->transactionStatus(
    'INV-1001' // Invoice number
);