Custom payment gateway without a new assembly

By default, the development of a custom payment gateway in Kentico CMS requires the creation of a new assembly and rebuilding the project with references to Kentico CMS assemblies. In some cases you do not have an option to rebuild the project in Visual Studio with a newly added payment gateway project. This article explains how you can use a custom payment gateway in Kentico CMS without the need of a new assembly.
Having to manage another assembly in your web site project is a very time consuming operation. Each time a new Hotfix is released or you just need to make some changes to your assembly, rebuilding of your custom project is needed with references to the current Kentico CMS assemblies. This disadvantage can be solved by using the new feature of Kentico CMS 5.5 and providing custom classes from the App_Code folder as described in the following article: Provide your classes from App_Code

You can follow these steps:

1.) Create the new payment method in CMS Desk -> Tools -> E-commerce -> Configuration -> Payment methods. You can use settings like:

Payment gateway assembly name: App_Code
Payment gateway class name: CustomProvider.PaymentProvider

2.) Please add the attached .cs file into your App_Code folder. There is a sample code for custom payment gateway. You can change the code according to your requirements.

3.) Then there should be code in the ~/App_Code/Global/CMS/CMSCustom.cs file like:

public static object GetCustomClass(string className)

switch (className)
case "CustomProvider.PaymentProvider":

return new CustomProvider.PaymentProvider();

return null;

-mr + hg-

See also: Developing custom payment gateways
Provide your classes from App_Code
CustomProvider.cs attachment

Applies to: Kentico CMS 5.5 R2
Share this article on   LinkedIn