The Hosted Payment Gateway Provider allows you to plug in your own payment gateway code. This article includes a sample Visual Studio project and explains how to develop your own payment gateway project that plugs into SmithCart.
The following are the requirements to implement a custom gateway provider:
- Visual Studio 2012 or greater
- C# programming language and framework knowledge
- DNN v7.1 or greater installed
- SmithCart v6.92 or greater installed
- Developer API doc from the payment gateway you want to integrate
Download Payment Gateway Project
1. The first step is to download the sample project for the hosted payment gateway:
2. Unzip the file you just downloaded
Example Payment Gateway Project
1. Double click on the AuthorizeSIM.sln
2. After you double click on the solution, Visual Studio should load and open the project and your solution explorer should be displayed as follows:
If you want to create your own visual studio project you should create a .Net Class Library project.
3. In solution explorer, expand the "References" and the following 5 references are required:
4. In solution explorer, double click on "AuthorizeSIM.cs" to open it.
At the top of the cs file you will need the following 4 using statements:
5. Namespace and Class
public sealed class AuthorizeSIM : SmithPaymentProvider, IGatewayHosted
- The namespace should be Smith.Providers.Payments
- Decorate the class with the [Gateway(GatewayMode.Hosted)] attribute
- The class must inherit from SmithPaymentProvider base class
- For a direct gateway the class must implement IGatewayDirect interface
- For a hosted gateway the class must implement IGatewayHosted inteface
6. The following changes need to be made to the web.config located in the root of your DNN install:
<section name="payment" requirePermission="false"
type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" />
type="Smith.Providers.Payments.BuyNowGatewayProvider, SmithBuyNow" />
<add name="AuthorizeSIM" type="Smith.Providers.Payments.AuthorizeSIM, AuthorizeSIM"
merchantID="1234567890" merchantKey="A0B1C2D3E4F5" testMode="false"
The merchantID and merchantKey are your gateway credentials provided to you by your payment gateway company when you signed up.
6. Build the project in Visual Studio and place the assembly (dll) in the /bin folder located off the root of your DNN install.
Last Step - In SmithCart
The last step is to tell SmithCart you are using a custom hosted gateway:
- Go to your DNN site and login as admin
- Navigate to the page where you added the BuyNow module
- From the Store Setup menu select Payment Setup as follows:
- Select the Payment Gateway tab:
- From the Payment Gateway dropdown select Custom Payment Provider - Hosted
- You don't need to enter your gateway credentials here as they are referenced from your web.config
- Click the "Save" button to save the custom payment provider as your new gateway.
- Add a product to your cart and test your new payment gateway.