Page tree
Skip to end of metadata
Go to start of metadata
  •  finish topics

Create a payment provider class

Derive it from PaymentMethodBase and optionally from IConfigurable. Decorate the provider with required attributes:

  • SystemName: The system name of the provider.
  • SystemName: The friendly name of the provider.
  • DisplayOrder: The display order in payment method lists.
  • DependentWidgets: Optional. System name of a widget that should be activated\deactivated when the payment method is activated\deactivated.

Example

[SystemName("Payments.PayoneCreditCard")]
[FriendlyName("Payone credit card")]
[DisplayOrder(10)]
[DependentWidgets("Widgets.Payone")]
public class CreditCardProvider : PaymentMethodBase

Develop the core implementation of your payment method by overriding the properties and methods of PaymentMethodBase. If your plugin implements multiple payment methods then add one payment provider for each payment method. For example the PayPal plugin has currently three providers (Direct, Express and Standard).

Methods of PaymentMethodBase in detail

  • PreProcessPayment: Called while placing an order but before the order object has been created and stored into the database. Typically used for preauthorization when the payment gateway reports a failure that leads to order cancellation.
  • ProcessPayment: .....
  • PostProcessPayment: .....
  • GetAdditionalHandlingFee: .....

Create a payment controller

Derive it from PaymentControllerBase. Add a PaymentInfo action method that returns a partial view with information of your payment method displayed in checkout payment list. Optional (if required): Add endpoints for the payment gateway of your payment method. For instance IPN (instant payment notification) should be handled here.

Methods of PaymentControllerBase in detail

  • ValidatePaymentForm: Used to validate the form data entered by the customer in checkout, for example a credit card number.
  • GetPaymentInfo: Deprecated method to temporary store data entered by the customer in checkout. Better use HttpContextBase.GetCheckoutState().CustomProperties if you need session based data storing during checkout.
  • GetPaymentSummary: Return a string as short summary of the data entered by the customer in checkout.

Properties of PaymentMethodBase in detail

  • RequiresInteraction: Gets a value indicating whether the payment method requires user input before proceeding in checkout (e.g. CreditCard, DirectDebit etc.).
  • SupportCapture: Gets a value indicating whether payment capturing is supported.
  • PaymentMethodType: Gets the payment method type. See below.
  • .....

Values of PaymentMethodType

  • Unknown: ....
  • Standard: ....
  • Redirection: ...
  • Button: ....
  • StandardAndButton: ....
  • StandardAndRedirection: Rare special case. Payment information is entered in checkout and customer is redirected to complete payment (e.g. 3D Secure) after order has been placed.
  • No labels