• Welcome to KonaKart Community Forum. Please login or sign up.

Add a new payment gateway

Started by BruceLee, October 18, 2007, 02:47:29 am

Previous topic - Next topic


Dear Team,

We'd try to add a new payment gateway. There are 2 ways for it. One is our app makes a URL with several parameters, then the customer is directed to the payment gateway website and finish the order. URL like

In this case, don't we need a new KK payment module? But the saveOrder() also requires an paymentMethod, how can we make it not using any payment module?

The second is like authorizenet, our app sends a http request to payment gw vendor and processes the response.

I tried to look at the FAQ, but still don't have compelete idea what's the required steps  to add it.
Do you have more detailed document for adding a new payment gateway?

This payment vendor is very big in Asia (similar to PayPal). I think we can contribute to KK when we are done.

Thanks in advance!


Hi Bruce,

In KonaKart there are two styles of payment module that you can add.   One sounds similar to your first example - eg. paypal, and the other sounds similar to your second.

The former style directs the user to the payment gateway for capturing the credit card information whereas the latter style just sends the credit card information to the payment gateway.

The easiest way to create additional payment gateway modules is to copy existing examples - for which you have full source.   Choose one that matches the style you require (of the two styles mentioned above) and choose one with similar parameters if possible.

A guide:

If you use the Authorize.Net example you will use the style of gateway under com.konakart.actions.gateways.

Copy either Authorize.Net or USAePay as your starting points... inherit from BaseGatewayAction.

Your call to the payment gateway will need to go in your implementation in com.konakart.actions.gateways

Also, you need to code your versions of either Authorize.Net or USAePay in com.konakart.bl.modules.payment.

Also, you need to code your versions of either Authorize.Net or USAePay in com.konakartadmin.modules.payment   (these are so that the module can be set up and configured using the KonaKart Admin App).

You have to add your gateway to the admin properties file:  (or equivalent under Linux/Unix)

C:\Program Files\KonaKart\webapps\konakartadmin\WEB-INF\classes\konakartadmin.properties

Add to this section:

# -----------------------------------------------------------------------------------
# Set the class names of the various modules you would like to make available.
# The administrator can still choose to enable or disable these.
# Note that if you remove a module from the definitions below that has already been
# set up in the database the users may still have access to the modules in the
# konakart application.   Hence, it is advisable to remove the modules before they
# are removed from these definitions.

# Make these space or semi-colon-separated class names - they have implied prefixes
# of:
#     com.konakartadmin.modules.payment.{lower case module name}.
#     com.konakartadmin.modules.shipping.{lower case module name}.
#     com.konakartadmin.modules.orderTotal.{lower case module name}.

konakart.modules.payment=Paypal Chronopay Epaybg Cod Worldpay Authorizenet Usaepay YourNewOne
konakart.modules.shipping=Flat Item Table Zones Free
konakart.modules.ordertotal=Shipping SubTotal Tax Total ProductDiscount TotalDiscount

# -----------------------------------------------------------------------------------

Finally you should be able to use the Admin App to install and enable your gateway.



Thank Brian for the helpful guide.
For first method, can we not add new payment module since the payment gw only needs an URL and we can do it in JSP? However the saveOrder() appears to require a paymentMethod. Maybe just use COD?



Hi Bruce,

It's not quite as simple as that  :)

If you follow one of our examples (i.e. ChronoPay or WorldPay) you'll see that the module fills in a PaymentDetails object with all of the parameters that need to be posted. Some of these parameters are saved as configuration variables and can be edited through the Admin App since they may be parameters to identify the merchant and so never change. Other parameters depend on the order and the customer since they may include the total amount to be billed and the customer's name and / or address etc.

The JSP uses the information in the PaymentDetails object to post data to the payment gateway and direct the user to the payment gateway's web site. Once there, the user completes the transaction and is redirected back to KonaKart (usually to a successful or unsuccessful return page). Since the transaction was completed on another web site, KonaKart is informed of the result through a callback from the payment gateway (see the actions under com.konakart.actions.ipn) and only when it receives this callback does it change the state of the order, send a mail etc.

Hope this info helps.