Skip to content
  • There are no suggestions because the search field is empty.

How to Add a New Payment Getaway [Migration Draft]

Description of sample files


All of the files are heavily commented and contain example code. You can also use any of the many payment gateways that already exist in ProductCart as a reference. You will find a link to the files at the bottom of this article.

The files provided in the ZIP archive available on this page are:
  1. Control Panel Files
    NOTE: the “pcadmin” folder is usually renamed on a live store for security purposes. Make sure to upload the files to the correct folder.
    • pcadmin/RTGatewayConstants.asp
      Do not rename this file
    • pcadmin/RTGatewayIncludes.asp
      Do not rename this file
    • pcadmin/upddbGatewayName.asp
      This file will be used to update your database if you wish to do this through a script rather than manually. This file is optional and you will find the code that invokes it the “RT_GatewayName.asp” file.
    • pcadmin/Gateways/RT_GatewayName.asp
      Note that this goes into the /pcadmin/gateways/ folder. This file is specific to your gateway and contains the variables that the gateway requires to function. It saves the information into the database so that it can be retrieved by the storefront. This file must be renamed and should be named in a way that is more consistent with your payment gateway name (e.g. “RT_myPaymentGateway.asp”).
  2. Storefront Files
    There is only 1 file that goes in the “pc” folder: pc/gwGatewayName.asp (where the GatewayName portion of the file name should be a short description of your payment gateway).

    This file is specific to your gateway (make sure that you do not overwrite any existing file) and contains the form that customers will use to enter their payment information. If the payment information is to be entered directly on the gateway's Web site (hosted payment solution), this is the file where you will need to add code to post data to the payment gateway's secure page (e.g. order amount).
 

Updating the order status


It is important that you integrate a payment gateway that will send a response back to the shopping cart. This will enable ProductCart to update the order status in the store database and trigger many other tasks that happen after a successful payment has been submitted.

When a response is returned by the payment gateway, there are two pieces of information that are normally saved at the order level (if they are provided): the Transaction ID and the Bank Authorization Code. If one or both of these values are provided by the payment gateway, they should be saved to the following session variables:
  • session(“GWAuthCode”) = The Bank's Authorization Code
  • session(“GWTransId”)= The Gateway Transaction ID (sometimes the Order ID is used)

Most of the time the response will be posted to the same file that you sent it from ( pc/gwGatewayName.asp). If this is the case, then after storing Transaction and Authorization Codes in the session variables mentioned above, redirect to the file pc/gwReturn.asp, where the order status is updated and all other order processing tasks take place.

To do this, use the following URL format where the <GatewayName> is the nickname given to your payment gateway.
response.redirect "gwReturn.asp?s=true&gw=<GatewayName>"

If the payment was not successful, do not redirect to gwReturn.asp, but rather notify the customer on the payment gateway page itself ( pc/gwGatewayName.asp). Try to provide as much information as possible so that the customer knows what went wrong and is able to attempt another transaction.

Most payment gateways return error codes and provide a table of descriptions associated with each of those errors. Although the table can be quite long, make sure to translate the error codes into meaningful descriptions at least for the most common error codes (e.g. credit card expired).
 

Files


Download the files here: pc_adding_new_gateway_022008.zip