Create the payment processor provider

To create a payment processor provider for the payment processor you must perform the following:

  1. Create a class to represent the payment processor provider.
    In the folder for your custom payment processor, add a new class item.
  2. Make the class public.
    Define the class to use the public access specifier.
  3. Implement the IPaymentProcessorProvider interface.
    The IPaymentProcessorProvider interface requires the following members:
    • IPaymentResponse Credit(IPaymentRequest data);
      Submits a credit request to the payment processor.
    • IPaymentResponse Sale(IPaymentRequest data);
      Submits a sale request to the payment processor.
    • IPaymentResponse Authorize(IPaymentRequest data);
      Submits a capture request to the payment processor.
    • IPaymentResponse Capture(IPaymentRequest data, string originalTransactionID);
      Submits a capture request to the payment processor.
    • IPaymentResponse Void(IPaymentRequest data, string originalTransactionID);
      Submits a void request to the payment processor.
    • IPaymentResponse AuthVoidCapture(IPaymentRequest data);
      Submits a authorize,void and capture request to the payment processor.
    • IPaymentResponse PerformValidations(IPaymentRequest data, bool avsAddress, bool avsZip, bool csc);
      Performs validations on payment processor.
    • IPaymentResponse TestConnection(IPaymentRequest data);
      Tests the connection between merchant and payment processor.
    • IPaymentResponse SubmitTransaction(IPaymentRequest data);
      Generic Submit Transaction method which will called by the processor. All other transactions that can happen with the provider have to be called from this method.

      NOTE: To invalidate the transaction, set the IsSuccess property of the IPaymentResponse object to false and set the GatewayResponse property to the error message.
  4. Implement the required methods.
    The methods described above should wrap the logic that calls the payment processor API. By default the SubmitTransaction method is called upon checkout. In this method you can can call any of the other methods depending on the settings.

Use the following code sample:

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?