Skip to content

Pay.ir online payment - درگاه پرداخت Pay.ir به زبان PHP - https://dpsoft.ir

License

Notifications You must be signed in to change notification settings

dpsoft-official/pay.ir

Repository files navigation

Pay.ir online payment - درگاه پرداخت Pay.ir به زبان PHP

Latest Version on Packagist Total Downloads

Installation

You can install the package via composer:

composer require dpsoft/pay.ir

Usage

copy sample directory to server. Open request.php in browser and bala balah ...

Request

try {
    $pay = new \Dpsoft\Pay\Pay($apiKey);
    $result = $pay->request($callbackUrl,$amount);
    //save amount and invoice id to forther use
    $_SESSION['amount']=$amount;
    $_SESSION['invoice_id']=$result['invoice_id'];

    $pay->redirectToBank();
    exit();
}catch (Throwable $exception){
    echo $exception->getMessage();
}

Response

try {
    $pay = new \Dpsoft\Pay\Pay();
    $result = $pay->verify($_SESSION['amount'],$_SESSION['invoice_id']);
    //save result. The keys are: card_number,transaction_id and token for example $result['token']
    echo "Successfull transaction.";
}catch (Throwable $exception){
    echo "Error in transaction: ";
}

Testing

composer test

Security

If you discover any security related issues, please email info@dpsoft.ir instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Pay.ir online payment - درگاه پرداخت Pay.ir به زبان PHP - https://dpsoft.ir

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages