How to create custom Payment Method in Bagisto ?

Updated 15 May 2023

Payment Method

It becomes very easy to create custom Payment Methods in bagisto for both (i.e. Novice developer as well as Professional Developers). As the diversity of payment methods provide the options to customer for payment when they proceed to checkout. On another perspective, multiple payment methods are a great strategy to reach out to the global marketplace.

There are basically two ways to create Custom payment Methods in bagisto.

Package Generator

If you are using bagisto 1.2.0 or above, what you can do is, You can simply run the command below which will make appropriate directory structure for you which will be used further.

If, in case your Package Name already exist at the same directory, you can also use –force with the above command which goes like this:

This will create the whole directory for you and you don’t have to manually do it.

Manual Way

You have to create the directory structure of your own. Follow and create the directory structure mentioned below.

Create this directory structure to create your payment method.

 

Step 1: You have to add your Payment Method in Admin Panel

  1. Go to Config folder present inside your package -> src.
  2. Now you have to add some keys and there values which helps you adding you payment Method at the admin end Configuration.
  3. You can use the keys below and edit at your own end according to the need of yours.

What this will do is, It will create the fields in the admin end where you can configure your settings. It will look like this:

Step 2: Add your payment to paymentmethods.php

Once you have added fields at admin end you just have to add your payment Method in the file paymentmethods.php present inside Your package -> src -> payment. it helps in operating your Payment Method.

You can change the value in these keys as per your Payment Method:

After doing all these things and enabling payment method from the admin end, you’ll be able to see the payment at the front end at the time of checkout.

Rest Important Folders

What are the possible ways to send the details of the payment to the payment server ?

You can either use Guzzle HTTP or Curl Request to send the data to your payment server.
If you are using third party Payment Methods. That comes with the already made APIs which include the codes to send your data to payment server.

Note:

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • Marcelo
    • saurav pathak (Moderator)
  • Start a Project


      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home