SSLCommerz Payment gateway library for Laravel framework

Last update: Oct 28, 2021

SSLCommerz

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

install

composer require sam-asif/sslcommerz

Provider

You need to update your application configuration in order to register the package so it can be loaded by Laravel, just update your config/app.php file adding the following code at the end of your 'providers' section:

config/app.php



return [
    // ...
    'providers' => [
        SamAsif\Sslcommerz\SSLCommerzServiceProvider::class,
        // ...
    ],
    // ...
];

publish

php artisan vendor:publish

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

If your request value contain following key

total_amount
currency
tran_id
cus_name
cus_email
cus_add1
cus_add2
cus_city
cus_state
cus_postcode
cus_country
cus_phone
cus_fax
ship_name
ship_add1
ship_add2
ship_city
ship_state
ship_postcode
ship_phone
ship_country
shipping_method
product_name
product_category
product_profile
value_a
value_b
value_c
value_d

Then just call the controller method.



use SamAsif\Sslcommerz\Http\Controllers\SamSSL;


class OrderController extends Controller
{

 public function Order(Request $request)
    {

    	// .......

    	$sslc = new SamSSL();
        $payment_options = $sslc->index($request, 'hosted');



        if (!is_array($payment_options)) {
            print_r($payment_options);
            $payment_options = array();
        }

    }

}

If your request value dostn't contain those key, then define an array with those key and call the controller function.

index($post_data, 'hosted'); if (!is_array($payment_options)) { print_r($payment_options); $payment_options = array(); } } // For received return value public function return(Request $request){ return $request->all(); } } ">


use SamAsif\Sslcommerz\Http\Controllers\SamSSL;


class OrderController extends Controller
{

 public function Order(Request $request)
    {

    	$post_data = array();
        $post_data['total_amount'] = '10'; # You cant not pay less than 10
        $post_data['currency'] = "BDT";
        $post_data['tran_id'] = uniqid(); // tran_id must be unique
        // .......
    	

    	// Initialize SSlcommerz gateway

    	$sslc = new SamSSL();
        $payment_options = $sslc->index($post_data, 'hosted');



        if (!is_array($payment_options)) {
            print_r($payment_options);
            $payment_options = array();
        }

    }


    // For received return  value

    public function return(Request $request){
      return $request->all();
    }

}

Web Route

Route::post('/sslcommerz/return', 'OrderController::[email protected]')->name('sslcommerz.return');

This route for the received the return value from SSLCommerz gateway.

GitHub

https://github.com/md-asifiqbal/SAM-SSLCommerz-
You might also like...

List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Aug 10, 2022

Framework - 🙃 Phony. Real-like Fake Data Generation Framework

Framework - 🙃 Phony. Real-like Fake Data Generation Framework

🙃 Framework This repository contains the 🙃 Phony Framework. 🙃 Start generating fake data with 🙃 Phony Framework, visit the main Phony Repository.

Jan 12, 2022

Laravel breeze is a PHP Laravel library that provides Authentication features such as Login page , Register, Reset Password and creating all Sessions Required.

About Laravel breeze To give you a head start building your new Laravel application, we are happy to offer authentication and application starter kits

Jul 30, 2022

User to Team associations with invitation system for the Laravel 5 Framework

Teamwork This package supports Laravel 6 and above. Teamwork is the fastest and easiest method to add a User / Team association with Invites to your L

Aug 7, 2022

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

Aug 14, 2022

Your users do not always report errors, LaraBug does. LaraBug is a simple to use and implement error tracker built for the Laravel framework.

Your users do not always report errors, LaraBug does. LaraBug is a simple to use and implement error tracker built for the Laravel framework.

Your users do not always report errors, LaraBug does. LaraBug is a simple to use and implement error tracker built for the Laravel framework. This rep

Jul 25, 2022

JSON-RPC 2.0 API server for @Laravel framework

JSON-RPC 2.0 API server for @Laravel framework

Sajya is an open-source project aiming to implement the JSON-RPC 2.0 server specification for the Laravel quickly.

Aug 8, 2022

Stapler-based file upload package for the Laravel framework.

laravel-stapler Laravel-Stapler is a Stapler-based file upload package for the Laravel framework. It provides a full set of Laravel commands, a migrat

Jul 25, 2022

OpenShift QuickStart - Laravel 5.0 Framework

Laravel 5.0 on OpenShift Laravel is a free, open source PHP web application framework, designed for the development of model–view–controller (MVC) web

Jul 18, 2022
Integrasi Payment Gateway Midtrans dengan Framework Laravel 8

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Aug 12, 2022
A laravel wrapper for BnpParibas Mercanet payment gateway
A laravel wrapper for BnpParibas Mercanet payment gateway

Laravel Mercanet A laravel wrapper for BnpParibas Mercanet which provide a lightweight public api to process your online payments from your laravel ap

Jul 3, 2022
Backend application using Laravel 9.x REST APIs for games topup from digiflazz.com and payment gateway using xendit.co

TOPUP - Laravel 9.x REST API Documentation is still on progress. For now, you can fork this postman collection Installation Clone this project git clo

Jul 31, 2022
Learn how to accept a payment from customers around the world with a variety of payment methods.

Accept a payment Learn how to securely accept payments online. This repository includes examples of 2 types of integration types. Prebuilt Checkout pa

Aug 11, 2022
PayuMoney Gateway wrapper for Laravel.
PayuMoney Gateway wrapper for Laravel.

PayuMoney Integration with Laravel Easy to use integration for PayUMoney into Laravel apps. Video Tutorial Usage composer require infyomlabs/laravel-p

Mar 2, 2022
Laravel SMS Gateway

This is a Laravel Package for SMS Gateway Integration. Now Sending SMS is easy.

Jun 19, 2022
Zarinpal is a laravel package to easily use zarinpal.com payment services in your applications
Zarinpal is a laravel package to easily use zarinpal.com payment services in your applications

پکیج اتصال به درگاه پرداخت زرین پال zarinpal.com برای اتصال به درگاه پرداخت اینترنتی زرین پال و استفاده از api های آن می توانید از این پکیج استفاده کن

Jan 26, 2022
A Laravel package to simplify using DPO Payment API in your application.

DPO (Direct Pay Online) Laravel Package The best DPO Laravel package, simple Ever This is the package that will help you add DPO Payment API to your L

Oct 23, 2021
Dedicated laravel package for Behpadakht Mellat bank payment service.
Dedicated laravel package for Behpadakht Mellat bank payment service.

Iranian Mellat bank full online payment service Dedicated laravel package for Behpadakht Mellat bank payment service. Features Event calls Log on chan

Apr 19, 2022
Integerating Laravel with Payment Gateways Paypal, Stripe, Paymob, Paytabs and MyFatoorah

This Repo is for integerating Laravel with some Payment gateways Integeration with For these integerations you need to provide env variables from your

Jul 12, 2022