Giter Club home page Giter Club logo

sslcommerz's Introduction

SSLCommerz

SSLCommerz Payment gateway library for Laravel framework. Official documentation is here.

install

composer require uzzal/sslcommerz

publish

artisan vendor:publish

This command will create a sslcommerz.php file inside the config directory. Configure your parameters in your .env file

#sslcommerz
STORE_ID=your_store_id
STORE_PASSWORD=your_store_password
SUCCESS_URL=http://your-domain.at/success.php
FAIL_URL=http://your-domain.at/fail.php
CANCEL_URL=http://your-domain.at/cancel.php
SANDBOX_MODE=true

Initiating a Payment session

This initSession will give you a gateway url. With this url you will be able to continue the payment through sslcommerz.

$customer = new Customer('Mahabubul Hasan', '[email protected]', '0171xxxxx22');
$resp = Client::initSession($customer, 29); //29 is the amount
echo $resp->getGatewayUrl();

or with configuration

$customer = new Customer('Mahabubul Hasan', '[email protected]', '0171xxxxx22');
$config[SessionRequest::EMI] = '0';
$resp = Client::initSession($customer, 29, $config);
echo $resp->getGatewayUrl();

Request for Validation

This verifyOrder method takes a val_id as parameter which you will get in the IPN request.

$resp = Client::verifyOrder('180828114058np43AJdzJJOsYzc');
echo 'status: '.$resp->getStatus();
echo 'transaction: '.$resp->getTransactionId();

IPN Listener (Step 4,5)

After filling the card information and submission in the sslcommerz window it will send a IPN notificaion to your specified IPN url. To grab the notification use the following code. For more details see here

if(ipn_hash_varify(config('sslcommerz.store_password'))){
    $ipn = new IpnNotification($_POST);
    $val_id = $ipn->getValId();
    $transaction_id = $ipn->getTransactionId();
    $amount = $ipn->getAmount();
    $resp = Client::verifyOrder($val_id);
} 

SSLCommerz process flow

alt text

sslcommerz's People

Contributors

mahabubulhasan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.