Posted by Aaron on November 27, 2013

Creating a New Credit Card Payment Gateway Integration

Comments (7)

Does BV Commerce support ________ payment gateway?

We hear this question all of the time. While BV Commerce does support a lot of credit card payment gateways out-of-the-box it doesn't support every one. Fortunately we provide an easy-to-use plugin architecture for developers to create new payment gateway integrations. In this article we'll walk through the plugin architecture and how to leverage it for your integration.

Payment Gateway Class

Create a new class in the /App_Code folder of your website using the name of your payment gateway. The class should inherit from BVSoftware.Bvc5.Payment.CCPaymentBase. Download a commented example of what your class should look like. Note that you will need to add the code specific to your payment gateway integration.

There are two string properties that your class must override:

  • GatewayId
  • GatewayName

GatewayId should return a GUID string that you generate; do not use the GUID value from the sample code. The GatewayName property should return the 'friendly' name of your gateway.

There are five Boolean functions that you must override in your class that are used to tell the system what functionality your gateway integration supports. They are:

  • SupportsAuthorize
  • SupportsCapture
  • SupportsCharge
  • SupportsRefund
  • SupportsVoid

These functions should simply return True or False depending on what your gateway integration supports.

Lastly your class must override the ProcessCard function, which is where all of the magic happens. This function takes a string parameter called chargeType which should accept the following single-character values:

  • "A" (pre-authorize)
  • "P" (post-authorize)
  • "S" (sale/charge)
  • "V" (void)
  • "C" (credit)

Your function should perform the proper transaction with the payment gateway based on the chargeType value.

Admin Settings

With the integration coding complete we must create an admin interface for merchants to configure the payment gateway settings. Start by creating a folder in the /BVModules/CreditCardGateways/ folder with exactly the same name as the GatewayName property of your class (including spaces). Inside this folder create an Edit.ascx user control that inherits from BVSoftware.Bvc5.Core.Content.BVModule. Typical settings that you might store are things like:

  • Test/Debug Mode (Boolean)
  • Username (string)
  • Password (string)
  • Gateway URL

Use the SettingsManager property of your user control class (available since you're inheriting from the BVModule class) to load and save settings. SettingsManager has helper functions which handle encrypting and decrypting data (to securely store things like passwords) as well as functions for working with integers, decimals, and Boolean values so you don't have to cast them. You may have noticed the sample code linked above shows how to retrieve these settings in your payment gateway class. To see a completed example of an Edit.ascx user control for a payment gateway take a look at the Authorize.Net control at /BVModules/CreditCardGateways/Authorize.Net/Edit.ascx.

Wiring It Up

The last step is to tell BV Commerce about your new payment gateway so you can configure it via the admin. To do this you must edit the TaskLoader.Custom.vb class in the /App_Code folder. Find the LoadCustomCreditCardGateways subroutine. You will need to add a new instance of your payment gateway class to the result collection of CreditCardGateway objects. Your code should look something like this:

result.Add(New NewGateway())

That's it! You should now be able to select your payment gateway in the admin. Go to the Options >> Payment page and click the Edit button next to Credit Card. You should see your gateway listed in the Gateway dropdown box at the bottom of the page. Select it and click the Edit button to configure the settings on the Edit.ascx control that you created.


Comments (7) -

3/26/2015 5:45:06 AM #

Do you have any suggestions on writing the actual code for these other gateways (In BV5, the only supported gateway is authorize as it is the only one that has a project)?
The dropdown list shows dozens of other gateways, but none are wired up nor actually provided (unless I got a bad download a few years ago).
In other words: BVSoftware.BVC5.Payment.AuthorizeNet and BVSoftware.GoogleCheckout are the only 2 other projects in the solution.
Did we miss something?
We are running (a very heavily modified) version BV Commerce 5 SP3.2 (we couldn't upgrade due to the massive changes over the last 4 years), and purchased (or so we thought) the complete package w/source code.
Were the actual gateway projects supposed to be included?
I figure I could use Authorize.Net as a model to build an Intuit Merchant Services gateway (I've written several for other shopping carts), is this the way to go?


3/26/2015 10:02:21 AM #


Each payment gateway has different requirements, so the actual credit card processing/integration code will vary. That's why the above documentation provides only the framework. The Authorize.Net project should provide you with a complete example to work from.

BV Commerce 5.3.2 (5 SP3.2) did not include source code for any payment gateways except for Authorize.Net. Later versions of BV Commerce did, however not all payment gateway source code was provided due to licensing agreements.

Note that BV Commerce 2015 includes a QBMS integration.


3/26/2015 10:49:53 PM #

Okay, thanks for the info.
I'm using the Auth.Net code as a basis. Looks doable.


3/27/2015 11:29:40 PM #

Hi again,
Got everything done exactly and compiled, however the gateway does not show up on this list.
I'm stuck here:
result.Add(New NewGateway())

in the LoadCustomCreditCardGateways Sub in the TaskLoaderCustom

What is the proper syntax?
result.Add(New IntuitProvider()) doesn't work as it is undefined. Where is this defined?



3/28/2015 12:43:50 AM #

Looks like the providers are hardcoded into the BVSoftware.Bvc5.Payment.dll (which no source code was provided w/the rest of the source code). Your method cannot work as you have described without access to that project.


3/28/2015 1:30:47 AM #

Scratch that. Namespace & compile issue (going to bed now, not thinking clearly).
This worked:
    Public Shared Sub LoadCustomCreditCardGateways(ByVal result As Collection(Of Payment.CreditCardGateway))
        result.Add(New BVSoftware.BVC5.Payment.Intuit.IntuitProvider)
    End Sub


3/28/2015 2:24:23 PM #

I'm glad to hear that you got everything working, Dave.


Add comment

  • Comment
  • Preview

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012