How to add new Payment Gateway to Sngine?

First of all you need to know that Sngine now support only PayPal and Stripe as payment gateways that come with very good docs and APIs and PHP SKDs to integrate.

Also you must know that customization not part of support, Kindly check Envato item support policy: https://codecanyon.net/page/item_support_policy

So How to add it is totally back to you but where to integrate with Sngine and how Sngine integrated PayPal and Stripe that what we can provide you here and you can use this as a guide for you.

Also you must know that edit or extend Sngine functionality is totally OK with Codecanyon license terms and you are free to do it with no problem.

Also you need to know that you must have very good experience in PHP, MySQL, JavaScript, HTML and some CSS. If you don’t have such experience simply hire good web developer to do it for you, You can even hire us, Any custom work our development team can do it as a freelance job to suit your needs

For any Freelance work you can contact our development team from the contact form: https://codecanyon.net/user/zamblek#contact

Sometime we are not available for any freelance work as we are working on Sngine new releases or other works so you can hire anyone else and we totally recommend Envato Studio to avoid any problems like scammer who will take money and go away or give you very bad code with a lot of bugs.

Check Envato Studio: https://studio.envato.com/

Now let’s talk about technical staff

Number 1 to start you need to read the docs of your payment gateway, because every gateway has its own implementation for example PayPal different than Stripe.

But to add your own Gateway you can start with the view (HTML) from here:

content\themes\default\templates\_js_templates.tpl 

if you have enough experience in HTML and Mustache.js syntax you can learn what this code about, You can simply add a new button for your new payment method and change the style, icon and the most important the js_ … class like js_payment-*

Now let add some functionality to this button via JavaScript.

Located here: includes\assets\js\sngine\core.js

As you JavaScript ninja you can see how that code work and it handle both packages payment and wallet payments.

That will call PHP file to each payment located here:

includes\ajax\payments

and the parameters differ here PayPal need only the Package ID but Stripe will send Package ID and also Stripe Token and Stripe Email so you need to check your payment gateway docs to learn more.

So if your payment called “xyz” so xyz.php file that you will put here includes\ajax\payments

Will handle all PHP code and you will add some extra files from your payment gateway as we did for PayPal SDK or Stripe SDK that located here: includes\libs

And here your your job,

You can trace the paypal.php or stripe.php code to learn how they handle it. so all your edits will not be affected even after any new release but only on 2 files

–includes\assets\js\sngine\core.js

– content\themes\default\templates\_js_templates.tpl 

Hope this tutorial is useful for all of you.

If you or your developer have any further questions related to our code structure or Sngine database schema we will answer you with no problem.

Happy Sngine.