PHP code example of shahdah / sadded

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

    

shahdah / sadded example snippets




use Shahdah\Sadded\Sadded;

   'full_name'     => 'test test',
    'email'         => '[email protected]',
    'country_code'  => '213',
    'phone_number'  => '554668588',
];
$credentials = [
    'token' => "sk_test_tkZE18afpNM0XvqBx9lhinAV"
];

// step 01 create provider
$sadded = new Sadded('tap');
// step 02 extract getway
$getway = $sadded->getway();
// step 03 set Credentials
$getway->setCredentials($credentials);
// step 04 set Callback url
$getway->setCallbackUrl('http://127.0.0.1/callback');
// step 05 create customer
$customer = $getway->customer($customerData);
// step 06 charge
$charge = $customer->charge(10, "KWD");


dd($charge);