When you want to process credit card or electronic payments, you get a Merchant Account from your bank or other providers like Paypal. The Merchant account provider then may give you a choice of Payment Gateways, the companies who route the credit card requests to the issuers like Visa, Mastercard, American Express and manage the payments processing to your Merchant Account.
Compiere has provides an abstract class org.compiere.model.PaymentProcessor, which you can extend to interface to your specific payment gateway. Compiere provides implementations for some of the the main gateways in the US - PayFlowPro (PP_PayFlowPro), Optimal Payments (PP_Optimal). I did also some research for interfacing to PayPal and Authorize.net.
You define the data required for the payment processor in the Window Bank - Tab Payment processor. Here you define your payment processor class (e.g. org.compiere.model.PP_PayFlowPro) with your account/user names and passwords.
You can actually define multiple payment processors (e.g. one for Visa and MasterCard, one for Amex, one for debit cards). The selection what payment processor will be used is based on the credit card type and the payment amount (i.e. with that you can route bigger amounts to a certain processor).
When you implement your own payment gateway, you need to implement two methods:
/*** Process CreditCard (no date check)
* @return true if processed successfully
* @throws IllegalArgumentException
*/
public abstract boolean processCC () throws IllegalArgumentException; /**
* Payment is processed successfully
* @return true if OK
*/
public abstract boolean isProcessedOK();
The latter is used just to be able to re-query the reult of the first. The you will have all the information available to connect to the gateway and process the payment:
/** Bank Account Processor */protected MPaymentProcessor p_mpp; /** The Payment */
protected MPayment p_mp;
Note that you should not save the validation code in your database and if you store the actual credit card on your computer, you must encrypt the data (which is easy to do in Compiere).