magicway/momagic-laravel

Laravel library for Magic way payment gateway

1.0.0 2021-07-15 11:17 UTC

This package is auto-updated.

Last update: 2024-05-15 17:42:18 UTC


README

MagicWay Payment Gateway Integration - Laravel Library

Tags: e-commerce, magicway, payment-gateway, checkout, shop, cart, local-payment-gateway, international-payment-gateway

Requires: PHP >= 7.2, Laravel >= 6.0 and MySQL

License: MIT

Core Library Directory Structure

 |-- config/
    |-- magic_way.php
 |-- app/Library/MoMagic
    |-- MoMagicAbstraction.php (core file)
    |-- MoMagicInterface.php (core file)
    |-- MoMagicConnector.php (core file)
 |-- README.md
 |-- orders.sql

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/magic_way.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, STORE_PASSWORD,STORE_USER and STORE_EMAIL values on your project's .env file.

  • Step 5: Copy the MoMagicPaymentController 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 = [ '/success','/fail','/cancel','/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: Create a database and import the orders.sql table schema.

  • Step 10: For Checkout integration, you can update the MoMagicPaymentController->checkout() or use a different method according to your need. We have provided a basic sample from where you can kickstart the payment gateway integration.

  • Step 11: When user click Continue to checkout button, redirect customer to payment channel selection page.

  • Step 12: For redirecting action from MagicWay Payment gateway, we have also provided sample success(), fail(), cancel() and ipn() methods in MoMagicPaymentController. You can update those methods according to your need.

Contributors

Arifur Rahman

info@momagicbd.com