maryamnbyn/vandar-laravel

Laravel Library for Vandar Gateway

v1.1.3 2021-05-09 14:08 UTC

This package is auto-updated.

Last update: 2024-04-29 04:53:27 UTC


README

This Laravel package allows you to connect to Vandar payment services. See vandar.io for more info.

Installation

This package can be installed through Laravel:

composer require maryamnbyn/vandar-laravel

Add vandar configuration to config/services.php:

 'vandar' => [
        'api' => 'your api key',
        'test' => false
    ]

You can get your api key at Vandar Dashboard

Usage

In every class where Vandar is used, you need to use the Vandar facade:

use Vandar\Laravel\Facade\Vandar;

Then, the payment requests can be sent like this:

$result = Vandar::request($amount, $callback, $mobile = null, $factorNumber = null, $description = null);

Further information on the responses is available on Vandar Documentation, but keep in mind that you need to store the $result['token'] to verify the payment later on.

After this, you may redirect the user to the payment service using one of these methods, note that token is optional:

Vandar::redirect($token);
Vandar::redirectUrl($token);

After the user made the payment, Vandar will redirect the user to the callback specified above with a token in url. you can verify payment by passing the token to the verify method:

$token=$_GET['token']; // You can also use $request->get('token') in the scope of a laravel controller
$result = Vandar::verify($token);

for get info of transaction you can make requestInfo method and send token for that then you can get information ;
To get updates on any transactions you may have created, you may use the requestInfo method along with the token you stored:

$result = Vandar::requestInfo($token);

Contribution

Pull-requests fixing bugs or adding to the documentation are very appreciated!

License

This project is licensed under the GPL-3, see LICENSE for more information.