• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

sslcommerz/SSLCommerz-Laravel: SSLCOMMERZ is a bangladeshi payment gateway provi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

sslcommerz/SSLCommerz-Laravel

开源软件地址(OpenSource Url):

https://github.com/sslcommerz/SSLCommerz-Laravel

开源编程语言(OpenSource Language):

PHP 69.8%

开源软件介绍(OpenSource Introduction):

SSLCommerz - Laravel Library

For any technical support, please email at <[email protected]>

Tags: Payment Gateway, SSLCommerz, IPN

Requires: Laravel >= 5.6 and MySQL

License: GPLv2 or later

Core Library Directory Structure

 |-- config/
    |-- sslcommerz.php
 |-- app/Library/SslCommerz
    |-- AbstractSslCommerz.php (core file)
    |-- SslCommerzInterface.php (core file)
    |-- SslCommerzNotification.php (core file)
 |-- README.md
 |-- orders.sql (sample)

Instructions:

  • Step 1: Download and extract the library files.

  • Step 2: Copy the Library folder and put it in the laravel project's app/ directory. If needed, then run composer dump -o.

  • Step 3: Copy the config/sslcommerz.php file into your project's config/ folder.

Now, we have already copied the core library files. Let's do copy some other helpers files that is provided to understand the integration process. The other files are not related to core library.

  • Optional: If you later encounter issues with session destroying after redirect, you can set 'same_site' => null, in your config/session.php file.

  • Step 4: Add STORE_ID and STORE_PASSWORD values on your project's .env file. You can register for a store at https://developer.sslcommerz.com/registration/

  • Step 5: Copy the SslCommerzPaymentController into your project's Controllers folder.

  • Step 6: Copy the defined routes from routes/web.php into your project's route file.

  • Step 7: Add the below routes into the $excepts array of VerifyCsrfToken middleware.

protected $except = [
    '/pay-via-ajax', '/success','/cancel','/fail','/ipn'
];
  • Step 8: Copy the resources/views/*.blade.php files into your project's resources/views/ folder.

Now, let's go to the main integration part.

  • Step 9: To integrate popup checkout, 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 10: Use the below button where you want to show the "Pay Now" button:
<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="/pay-via-ajax"> Pay Now
</button>
  • Step 11: 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 payment gateway integration.

  • Step 12: 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 13: For redirecting action from SSLCommerz Payment gateway, we have also provided sample success.php, cancel.php, fail.phpfiles. You can update those files according to your need.

Contributors

Md. Rakibul Islam

Prabal Mallick




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap