Coder Social home page Coder Social logo

sslcommerz-php's Introduction

SSLCommerz Payment Gateway Integration - PHP Library

Library Directory

 |-- config/
    |-- config.php
 |-- lib/
    |-- AbstractSslCommerz.php (core file)
    |-- SslCommerzInterface.php (core file)
    |-- SslCommerzNotification.php (core file)
 |-- pg_redirection/
    |-- cancel.php
    |-- fail.php
    |-- success.php
    |-- ipn.php
 |-- README.md
 |-- orders.sql
 |-- db_connection.php
 |-- checkout_hosted.php
 |-- checkout_ajax.php
 |-- example_easycheckout.php
 |-- example_hosted.php
 |-- OrderTransaction.php

Instructions:

  • Step 1: Download and extract the library files into your project

  • Step 2: Create a database and import the orders.sql table schema. Then set the database credential on db_connection.php file.

  • Step 3: For Hosted Checkout integration, you can update the checkout_hosted.php or use a different file according to your need. We have provided a basic sample page from where you can kickstart the payment gateway integration.

  • Step 4: For EasyCheckout (Popup) integration, you can update the checkout_ajax.php or use a different file according to your need. We have provided a basic sample page from where you can kickstart the SSLCommerz payment gateway integration with EasyCheckout (Popup).

  • Step 5: Use the below button where you want to show the "Pay Now" button (change the values as needed):

<button class="your-button-class" id="sslczPayBtn"
        token="if you have any token validation"
        postdata="your javascript arrays or objects which requires in backend"
        order="If you already have the transaction generated for current order"
        endpoint="checkout_ajax.php"> Pay Now
</button>

  • Step 6: Use the below script before the end of body tag.
For Sandbox
<script>
    (function (window, document) {
        var loader = function () {
            var script = document.createElement("script"), tag = document.getElementsByTagName("script")[0];
            script.src = "https://sandbox.sslcommerz.com/embed.min.js?" + Math.random().toString(36).substring(7);
            tag.parentNode.insertBefore(script, tag);
        };

        window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
    })(window, document);
</script>

For Live
<script>
    (function (window, document) {
        var loader = function () {
            var script = document.createElement("script"), tag = document.getElementsByTagName("script")[0];
            script.src = "https://seamless-epay.sslcommerz.com/embed.min.js?" + Math.random().toString(36).substring(7);
            tag.parentNode.insertBefore(script, tag);
        };

        window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
    })(window, document);
</script>

  • Step 7: For redirecting action from SSLCommerz Payment gateway, we have also provided sample success.php, cancel.php, fail.php and ipn.php files. You can update those files according to your need.

Contributors

Prabal Mallick

Md. Rakibul Islam

[email protected]

sslcommerz-php's People

Contributors

rkbi avatar prabalsslw avatar nayemsayed avatar jmredwan 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.