Updated 15 May 2023
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.
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.
1 |
php artisan package:make-payment-method DemoPackage |
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:
1 |
php artisan package:make-payment-method DemoPackage --force |
This will create the whole directory for you and you don’t have to manually do it.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
<?php return [ [ 'key' => 'sales.paymentmethods.paypal_standard', 'name' => 'admin::app.admin.system.paypal-standard', 'sort' => 3, 'fields' => [ [ 'name' => 'title', 'title' => 'admin::app.admin.system.title', 'type' => 'text', 'validation' => 'required', 'channel_based' => false, 'locale_based' => true, ], [ 'name' => 'description', 'title' => 'admin::app.admin.system.description', 'type' => 'textarea', 'channel_based' => false, 'locale_based' => true, ], [ 'name' => 'business_account', 'title' => 'admin::app.admin.system.business-account', 'type' => 'select', 'type' => 'text', 'validation' => 'required', ], [ 'name' => 'active', 'title' => 'admin::app.admin.system.status', 'type' => 'boolean', 'validation' => 'required', 'channel_based' => false, 'locale_based' => true ], [ 'name' => 'sandbox', 'title' => 'admin::app.admin.system.sandbox', 'type' => 'boolean', 'validation' => 'required', 'channel_based' => false, 'locale_based' => true, ], [ 'name' => 'sort', 'title' => 'admin::app.admin.system.sort_order', 'type' => 'select', 'options' => [ [ 'title' => '1', 'value' => 1, ], [ 'title' => '2', 'value' => 2, ], [ 'title' => '3', 'value' => 3, ], [ 'title' => '4', 'value' => 4, ], ], ] ] ] ]; |
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:
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:
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php return [ 'paypal_standard' => [ 'code' => 'paypal_standard', 'title' => 'Paypal Standard', 'description' => 'Paypal Standard', 'class' => 'Webkul\Paypal\Payment\Standard', 'sandbox' => true, 'active' => true, 'sort' => 3, ] ]; |
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.
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.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
https://bagisto.com/en/extensions/laravel-ecommerce-pagseguro-payment-gateway/
the module does not discount values from the discount coupon, as it resolve.