Part 1 - Integrating Plug 'N Pay with Storefront Shopping Cart

by Erik Lane 27. February 2006 08:54

Storefront 6.0 (SF6) comes with over a dozen payment systems already integrated into it.  But there is always someone who wants one that is not there and this time its Plug 'N Pay.  SF6 does have a good help file that comes with a tutorial to integrate a payment server.  It outlines the 5 steps needed to accomplish this task.

Step 1: Adding the Payment Processing Service to the Store's Database
Step 2: Add a new case to CProcessor.CallProcessor()
Step 3: Creating a New Processor Class
Step 4: Handling the Results of the Transaction
Step 5: Indicating the Success of a Transaction

In this post I'll discuss the first two steps to integrate Plug 'N Pay (PNP) using the pnpcom.dll.  There are other ways to process payments to PNP without using the COM object but I've found this to be pretty straight forward and so that's what I'm rolling with.

Step 1: Adding the Payment Processing Service to the Store's Database
In the SF6 database insert a row into the Payment Processors table.  There are 17 columns in the table but for PNP I only need to use 4.  These are the 4 columns I'm using, their pseudo values, and the PNP variable name if applicable.

Column Name Value PNP Variable
Name PlugNPay n/a
MerchantID BobCobb Plublisher-Name
UserID bob@cobb.com Publisher-Email
LiveServerPath mode=debug&publisher-name={0}&publisher-email={1}&card-name={2}&card-number={3}&card-amount={4}&card-exp={5}/{6} n/a

If you notice the live server path is going to be used later in the code as a value in a string.format method.  Also the live server path is set for debug mode and when it goes live you'll want to remove that.

Step 2: Add a new case to CProcessor.CallProcessor()
Now PNP can be selected through the store’s Merchant Tools.  So now is the time to write the code to detect when its the payment processor being used.  The code responsible for this task is CallProcessor() and is located in StoreFront.SystemBase.Processors.  This ElseIf statement detects the name of the processor being used, instatiates a new PNP object based on the current order, sends the request, and then handles the error message if any.  So locate this ElseIf statement and then add in this piece of code.

   ElseIf Name.ToLower = "plugnpay" Then
                    Dim objPlugNPay As New CPlugNPay(Order)
                    objPlugNPay.sendRequest()
                    Message = objPlugNPay.ErrorMessage

 


Obviously we've not created the PNP class being used here but that's step 3 and we'll get to that in the next post.

Tags:
Comments are closed