Create the template of the settings control

In the template for the settings control you define the UI, that will allow the user to set the values of the payment settings object of the payment method. Because the settings are serialized and only used in your custom logic in the payment provider class, you can create any input fields you need.

To create the template of the settings field, you must perform the following:

  1. Create a new .ascx file.
    In the folder of your custom payment processor, add a new code file. Change its extension to .ascx.
  2. Mark the file as an embedded resource.
    Right-click on the file and select Properties. Set the Build Action property to Embedded Resource.
  3. Define the default labels for the Title, Description and Example properties of the control.
    Add Label controls for each of these properties and set their IDs to the respective values you have used in the class file.
  4. Create the input fields.
    This example uses input fields for the following settings:
    • Supported credit cards.
      This section represents a ChoiceItem control. The choices available for the supported credit cards field are used only in the custom logic inside the payment provider class. Because of this, you can specify as many choices as you need.
    • Processing mode, live and test username, live and test password.
      The processing mode field must be represented by a ChoiceItem control with two items – live and test. The username and the password fields must be represented by a TextField controls.

      NOTE: If you decide to use only one processing mode, you must not create a field for a processing mode property.

    • Timeout and payment type.
      The timeout field must be represented by a TextField control. The payment type field must be represented by a ChoiceItem control. The choices available for the payment type field are used only in the custom logic inside the payment provider class. Because of this, you can specify as many choices as you need.
  5. Create a hidden field for the ID of the payment method.
    This hidden field is needed in order to store and access the ID of the  payment method that is being managed.

NOTE: To create validation for the fields use the ValidationDefinition object.

NOTE: You can order and style the fields in your template as you need. The suggested structure serves as an example and as a guideline on how to group your fields. The most important thing is to pay attention to the types of the fields and the controls used for them, and to the IDs of the respective controls.

Use the following code for the whole template:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?