PHP code example of kpasokhi / savano

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

    

kpasokhi / savano example snippets


php composer.phar 

..... 


public function actionRequest()
{
    /* Your Data */
    $pin      = 'Your Pin';
    $callback = 'Your Callback Url';

    /* Save Price, OrderId and Authority In Your Storage */
    $price    = 1000;
    $orderId  = 1;

    $savano = new Savano;
    $savano->pin = $pin;

    if($request = $savano->request($price, $orderId, $callback)->getResult() === 1)
    {
        // $authority = $savano->getAuthority();
        // You can save your payment request data to the database in here before redirect user to bank

        return $this->redirect($savano->getRedirectUrl());
    }
    else
    {
        // Show Error.
        echo $savano->getErrorMessage();
    }
}

public function actionVerify()
{
    $pin = 'Your Pin';

    /* Fetch Price, OrderId and Authority From Your Storage */
    $authority = 'xxxxxxxxxxxxxxx';
    $price     = 1000;
    $orderId   = 1;

    $savano = new Savano;
    $savano->pin = $pin;

    if($verify = $savano->verify($authority, $price, $orderId)->getResult() === 1)
    {
        // Payment Successfully
    }
    else
    {
        // Show Error
        echo $savano->getErrorMessage();
    }
}

.....