paystar/laravel-ipg

A package for PayStar payment gateway and Those for whom time is important

v1.0.1 2023-02-07 19:11 UTC

This package is auto-updated.

Last update: 2024-12-15 11:09:43 UTC


README

PayStar Logo

This is a Laravel package for PayStar payment gateway.

Latest Version on Packagist GitHub issues GitHub stars GitHub forks Total Downloads GitHub license

⬇️ Installation guide

Install package

composer require paystar/laravel-ipg

Publish configs

php artisan vendor:publish --tag=paystar-ipg

📖 List of available methods

  • create(): return a token
  • payment(): auto redirect to gateway
  • verify(): verify transaction

✔️ How to use exists methods and options

  • Use create() method

    <?php
    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();
    List of extra option
    How to use this options
    <?php
    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 verify() method

    <?php
    use PayStar\Ipg\Facades\PayStarIpg;
    
    PayStarIpg::amount('AMOUNT')
        ->refNum('REF_NUM')
        ->sign('SIGN')
        ->verify();
  • Use payment() method

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

#️⃣ How to generate sign

<?php
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

👨‍💻 Author