Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    How to get started with creation of new payment gateway?

    Knowledge Base
    8
    28
    5533
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Deepanjali last edited by

      Re: How to add new payment gateway
      As I am new to payment gateways, so just a minute doubt from the guide: https://devdocs.bagisto.com/create_payment_method.html
      The directory structure to be created has to in the form of new package right?

      1 Reply Last reply Reply Quote 0
      • N
        Naresh-webkul last edited by

        Hi @Deepanjali ,
        IF You are using latest bagistop release v1.2.0-BETA1 then you can use our package generator to generate a payment method package:
        https://github.com/bagisto/bagisto-package-generator
        just read the readme file point 24 under the summery.
        here you can create a base directory structure for your payment method using command.
        ELSE please mention exactly what issue you are facing while implementing your payment method. and yes Directory structure must in the form of new package.

        Thanks!

        A D 2 Replies Last reply Reply Quote 0
        • A
          AshJi @Naresh-webkul last edited by

          @Naresh-webkul "Bagisto Package Generator" documentation says Requirement is Bagisto 1.1.2 or higher.

          So is it a must to have v1.2BETA? If possible I would like to tray with 1.1.2 instead of 1.2.

          1 Reply Last reply Reply Quote 0
          • V
            Vaishali Agarwal last edited by

            @AshJi
            Yes as the Document says, it's compatible with Bagisto 1.1.2 or higher version.
            You may use this generator for 1.1.2 as well.

            1 Reply Last reply Reply Quote 0
            • D
              Deepanjali @Naresh-webkul last edited by

              @Naresh-webkul I want to integrate PayU Money gateway, then also I should go about creating a payment method as "php artisan package:make-payment-method ACME/PayU" or is there another method?

              1 Reply Last reply Reply Quote 1
              • O
                otheriz last edited by

                @Naresh-webkul ,
                is this package generator compatible with the latest pull from master branch here ?
                https://github.com/bagisto/bagisto

                1 Reply Last reply Reply Quote 0
                • V
                  Vaishali Agarwal last edited by

                  @otheriz
                  Yes, package generator is compatible with bagisto master branch https://github.com/bagisto/bagisto/tree/master or bagisto v1.1.2 as well

                  1 Reply Last reply Reply Quote 1
                  • A
                    AshJi last edited by AshJi

                    @Naresh-webkul @Vaishali-Agarwal

                    I ran the below command of the package_generator module and was able to create a folder.

                    php artisan package:make-payment-method ACME/Stripe
                    

                    Unfortunately files under the newly created folder, are just some placeholder code with absolutely no explanation of the field and what needs to be done. Unfortunately this link https://devdocs.bagisto.com/create_payment_method.html is not much help either.

                    I compared the folder/file structure of newly created folder with that of OOB Webkul/PayPal. That is also different.

                    Webklu/Paypal/src [5 sub folders]
                    8167bfd2-da56-442c-9e56-563a804b6cfb-image.png

                    MyApp/Razorpay/src [3 sub folders]
                    9f6beb32-cfa8-476f-ab58-6e6f3de66305-image.png

                    Can you please help share some working example using the package_generator .

                    1 Reply Last reply Reply Quote 0
                    • A
                      AshJi last edited by

                      @Naresh-webkul @Vaishali-Agarwal Do you guys have any comments/suggestion? Or should one just give up payment integration?

                      @Deepanjali @otheriz wondering whether you folks have been successful in following the documentation and achieve payment GW integration?

                      1 Reply Last reply Reply Quote 0
                      • devansh-webkul
                        devansh-webkul last edited by

                        Hi @AshJi,

                        1. After running this command, you will get whole directory structure,
                        php artisan package:make-payment-method ACME/Stripe
                        
                        1. After running this command, you need to register you service provider in config/app.php.

                        2. After then add the namespace in the composer.json file in psr-4 key.

                        3. Run composer dump-autoload.

                        4. Run php artisan config:cache. This thing is important because may be you are doing everything right but after cache cleared you will get success.

                        Result:

                        Screenshot from 2020-09-08 16-45-32.png

                        D 1 Reply Last reply Reply Quote 0
                        • A
                          AshJi last edited by

                          Thanks @devansh-webkul for your revert. My other doubt about where I enter my app key, other secret keys which I receive from the PaymentGateway. From the UI I don't see a way to enter them. Am I missing something?

                          Please clarify and guide.

                          1 Reply Last reply Reply Quote 0
                          • D
                            Deepanjali @devansh-webkul last edited by

                            Hi @devansh-webkul,
                            Could you please elaborate on step 3 of the process, I'm not able to locate the correct composer.json file I guess

                            1 Reply Last reply Reply Quote 0
                            • A
                              AshJi last edited by

                              @Deepanjali composer.json file is in the Bagisto home directory.

                              839eaf91-55f8-4ab1-a3b7-b9d382d1800d-image.png

                              D 1 Reply Last reply Reply Quote 0
                              • D
                                Deepanjali @AshJi last edited by

                                This post is deleted!
                                1 Reply Last reply Reply Quote 0
                                • D
                                  Deepanjali last edited by

                                  The PayU payment has multiple options, while following the steps mentioned by @devansh-webkul makes it look like a single method:
                                  7082da5b-2b70-4697-ab14-f6cc51227a91-image.png
                                  How can I show the underlying methods and not the name of the gateway?

                                  1 Reply Last reply Reply Quote 0
                                  • devansh-webkul
                                    devansh-webkul last edited by

                                    @AshJi

                                    Hi, for that you need to create one more array key in file packages/ACME/Stripe/src/Config/system.php.

                                    Right now you only have 3 keys in that file. You need to create one more key in that file,

                                    For Example,

                                    return [
                                        [
                                            'key'    => 'sales.paymentmethods.stripe',
                                            'name'   => 'Stripe',
                                            'sort'   => 1,
                                            'fields' => [
                                                [
                                                        'name'          => 'active',
                                                        'title'         => 'Secret Key', // added hard coded for transaltion you need to add key
                                                        'type'          => 'text',
                                                        'validation'    => 'required',
                                                        'channel_based' => false,
                                                        'locale_based'  => true,
                                                ]
                                            ]
                                        ]
                                    ];
                                    

                                    And then rest is your development.

                                    1 Reply Last reply Reply Quote 0
                                    • A
                                      AshJi last edited by

                                      @devansh-webkul Added a new entry to the file

                                      packages/ACME/RazorPay/src/Config/system.php
                                      

                                      But I don't still understand the whole flow how this new Payment Gateway integration is supported. Where are we telling Bagisto which PG URL to hit to connect to the payment gateway?

                                       1 <?php
                                        2
                                        3 return [
                                        4     [
                                        5         'key'    => 'sales.paymentmethods.razorpay',
                                        6         'name'   => 'Razorpay',
                                        7         'sort'   => 1,
                                        8         'fields' => [
                                        9             [
                                       10                 'name'          => 'title',
                                       11                 'title'         => 'admin::app.admin.system.title',
                                       12                 'type'          => 'text',
                                       13                 'validation'    => 'required',
                                       14                 'channel_based' => false,
                                       15                 'locale_based'  => true,
                                       16             ], [
                                       17                 'name'          => 'description',
                                       18                 'title'         => 'admin::app.admin.system.description',
                                       19                 'type'          => 'textarea',
                                       20                 'channel_based' => false,
                                       21                 'locale_based'  => true,
                                       22             ], [
                                       23                 'name'          => 'active',
                                       24                 'title'         => 'admin::app.admin.system.status',
                                       25                 'type'          => 'boolean',
                                       26                 'validation'    => 'required',
                                       27                 'channel_based' => false,
                                       28                 'locale_based'  => true,
                                       29             ], [
                                       30                 'name'          => 'active',
                                       31                 'title'         => 'Secret Key',
                                       32                 'type'          => 'text',
                                       33                 'validation'    => 'required',
                                       34                 'channel_based' => false,
                                       35                 'locale_based'  => true,
                                       36             ]
                                       37         ]
                                       38     ]
                                       39 ];
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • devansh-webkul
                                        devansh-webkul last edited by

                                        Hi @AshJi

                                        This is just the boiler plate. For that you need to setup your code. You can take refrence of the Paypal payment gateway as well.

                                        D 1 Reply Last reply Reply Quote 0
                                        • A
                                          AshJi last edited by

                                          @devansh-webkul that was my initial query - why are folder structure of Paypal and one generated by your package different.

                                          If one generated by package is not complete then why should one use this package.

                                          I am confused now - does one use the package-generator module or clone Paypal folder.

                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            Deepanjali @devansh-webkul last edited by

                                            Hi @devansh-webkul ,
                                            Is there some documentation to integrate PayU or Razorpay gateway with out site,
                                            somewhere one can get to enter the redirection url and secret keys?

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post