PHP code example of paystar / laravel-ipg

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

    

paystar / laravel-ipg example snippets


    
    use PayStar\Ipg\Facades\PayStarIpg;
    
    PayStarIpg::amount('AMOUNT') // *
        ->orderId('ORDER_ID') // *
        ->callbackUrl('CALLBACK_URL') // If You don't use this method, we set this from config
        ->sign('SIGN') // If You don't use this method, we generate auto a sign
        ->create();
    

    
    use PayStar\Ipg\Facades\PayStarIpg;
    
  PayStarIpg::amount('AMOUNT') // *
        ->orderId('ORDER_ID') // *
        ->callbackUrl('CALLBACK_URL') // If You don't use this method, we set this from config
        ->sign('SIGN') // If You don't use this method, we generate auto a sign
        ->option([
            'name'            => 'Name',
            'phone'           => 'PHONE',
            'mail'            => 'MAIL',
            'description'     => 'DESCRIPTION',
            'allotment'       => 'ALLOTMENT',
            'callback_method' => 'CALLBACK_METHOD',
            'wallet_hashid'   => 'WALLET_HASHID',
            'national_code'   => 'NATIONAL_CODE',
        ])
        ->create();
    

    
    use PayStar\Ipg\Facades\PayStarIpg;
    
    PayStarIpg::amount('AMOUNT')
        ->refNum('REF_NUM')
        ->sign('SIGN')
        ->verify();
    

    
    use PayStar\Ipg\Facades\PayStarIpg;
    // Redirect to Gateway
    PayStarIpg::token('TOKEN')->payment();
    


use PayStar\Ipg\Facades\Encryption;

// The Encryption Facade has 3 methods

Encryption::sign($amount, $orderId, $callbackUrl); // Generate a sign with set algorithm in config file

Encryption::algos(); // Show list of hash Algorithms (hash_algos() method)
Encryption::hash($algo, $string, $key, $binary); // use hash_hmac() method
bash
php artisan vendor:publish --tag=paystar-ipg