Developing custom payment gateways |
Top Previous Next |
Creating a custom payment gateway
Here's a general overview of the process of integrating a custom payment gateway:
Creating a custom payment gateway form
Since the control is located in the site folder it is included in export package of your site.
Please note: Payment data, such as credit card numbers, credit card codes and others are not saved into the database because of security reasons.
Creating custom payment gateway class
Example The following example shows a custom payment processor implementation. It allows customers to pay for their orders using some external payment gateway similar to PayPal, let’s call it Custom Gateway. Customer is asked for her credit card number in the last step of checkout process. Credit card number is validated for emptiness and processed after the “Finish payment” button is clicked. If it succeeds payment process is performed – required payment data are attached to the payment url and customer is redirected to Custom Gateway. If payment process fails (payment gateway url is not defined) order payment result is updated and appropriate error message is displayed. Notice that order is saved before the customer is asked to pay for it, it happens immediately after the “Order now” button is clicked.
Please note:
Example of custom payment gateway definition. Custom payment gateway form
It is a simple form with one input field to enter customer credit card number, see image bellow.
CustomGatewayForm.ascx
CustomGatewayForm.ascx.cs
[C#]
Custom payment gateway class The following example uses assembly name CMS.CustomProvider and class CMS.CustomProvider.CustomGateway, however, you will need to use your own names.
CustomGateway.cs
[C#]
|