London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Payment gateways provide an interface to the system which provides payment processing. A payment type is passed to the payment gateway and the gateway executes the payment transaction with the payment system. One payment type is associated with each payment gateway.
When creating and configuring payment methods in EPiServer Commerce, you have the following options:
The various implementation options are described below..
Classes referred to here are available in the following namespaces:
These are the gateway properties to be configured when using the various options:
1. Create a separate project in the solution to store custom business logic implementations for your application, if this has not been done.
2. Create a class in this project that inherits from the abstract class AbstractPaymentGateway. This base class has only has one property Settings, and one method, ProcessPayment().
The Settings property is a dictionary type that allows other information regarding the gateway to be stored, for example web service authentication details for connecting to the payment provider or an indicator whether the payment provider call is for authorization or payment processing. ProcessPayment is the method used to contact the payment processing system and process payments.
Example: signature for the ProcessPayment method
bool ProcessPayment(Payment payment, ref string message);
Provide implementation for the ProcessPayment method to execute the payment transaction you need. Look at the BusinessLayer/OrderSystem/PaymentGateways/ICharge/IChargeGateway.cs class file for an example implementation.
3. Create an admin config user control. This is used to provide an interface in the Commerce Manager for the second tab of the Payment Method edit screen. This tab will not be available until after the information on the first tab for a new method is saved for the first time.
Example: minimum code for LoadObject() method
public void LoadObject(object dto)
{
_PaymentMethodDto = dto as PaymentMethodDto;
}
4. Re-compile the solution.
5. Copy the .dlls associated with the project where the payment gateway is implemented into the bin folders of both the Commerce Manager and Public websites.
6. In Commerce Manager, go to the Administration tab and Order System/Payments.
7. Click New.
8. Enter information about the method being added:
9. Re-open the payment method from the payment method list.
10. Go to the second tab and set any configuration information required for the particular implementation of this gateway.
11. Click OK to save the new information.
If you need a payment type that does not correspond to one of the payment types built into ECF, you can extend the built-in OtherPayment payment type with whatever meta fields you need.
If you are implementing your own gateway, you may want to add meta fields to one of the built-in payment types for instance CreditCardPayment, to store custom information. This can be done through Commerce Manager. See the steps under modifying the OtherPayment payment type, and use the same approach with the meta class you need to add meta fields to.
Last updated: Oct 21, 2014