PHP code example of husail / paystore-sdk

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

    

husail / paystore-sdk example snippets




use Husail\PayStore\Client;
use Husail\PayStore\Authentication;

$client = new Client(
    new Authentication(token: 'your-token')
);

$response = $client->merchant->all();
if ($response->successful()) {
    // Handle the response
}



use Monolog\Logger;
use Husail\PayStore\Client;
use Monolog\Handler\StreamHandler;
use Husail\PayStore\Authentication;
use Husail\PayStore\HttpClient\Message\Formatter\SimpleFormatter;

$logger = new Logger('my_logger');
$logger->pushHandler(new StreamHandler(__DIR__ . '/paystore.log'));

$client = new Client(
    new Authentication(token: 'your-token'),
    logger: $logger,
    formatter: new SimpleFormatter(true) // 'true' enables pretty-printed JSON logs
);

$response = $client->merchant->all();
if ($response->successful()) {
    // Handle the response
}

use PayStore;

$response = PayStore::client()->merchant->all();
if ($response->successful()) {
    // Handle the response
}
bash
   php artisan vendor:publish --provider="Husail\PayStore\PayStoreServiceProvider"