How to integrate PayPal (PayFlow Pro)
This document provides the most basic information necessary to setup ADempiere to handle credit card transaction using PayPal PayFlow Pro as the payment gateway.
1. Getting Started
You will need an active PayPal Business account for testing or production, go visit PayPal Manager https://manager.paypal.com/ page to create one if you don't already own one. To process additional credit card types, please contact PayPal.
2. Setup
2.1 ADempiere Setup
- Logon to ADempiere
- go to Bank > Account > Payment Processor
Host Address = pilot-payflowpro.paypal.com (testing) or payflowpro.paypal.com (production) Host Port = 443 Partner ID = xxxxxxx Vendor ID = xxxxxxx User ID = xxxxxxx Password = xxxxxxx Payment Processor Class = org.compiere.model.PP_PayFlowPro
- Partner ID, Vendor ID and User ID should be created and emailed to your for confirmation once your PayPal Manager account was created successfully.
2.2 Transaction Type
At the time of writing, only SALES transaction type is implemented in ADempiere 3.5.3a, here is an extraction from the source code(..base/src/org/compiere/model/PP_PayFlowPro.java)
public boolean processCC () throws IllegalArgumentException { log.fine(p_mpp.getHostAddress() + " " + p_mpp.getHostPort() + ", Timeout=" + getTimeout() + "; Proxy=" + p_mpp.getProxyAddress() + " " + p_mpp.getProxyPort() + " " + p_mpp.getProxyLogon() + " " + p_mpp.getProxyPassword()); // StringBuffer param = new StringBuffer(); // Transaction Type if (p_mp.getTrxType().equals(MPayment.TRXTYPE_Sales)) param.append("TRXTYPE=").append(p_mp.getTrxType()); else throw new IllegalArgumentException("PP_PayFlowPro TrxType not supported - " + p_mp.getTrxType()); // Mandatory Fields param.append("&TENDER=C") // CreditCard .append("&ACCT=").append(MPaymentValidate.checkNumeric(p_mp.getCreditCardNumber())); // CreditCard No param.append("&EXPDATE="); // ExpNo String month = String.valueOf(p_mp.getCreditCardExpMM()); if (month.length() == 1) param.append("0"); param.append(month); int expYY = p_mp.getCreditCardExpYY(); if (expYY > 2000) expYY -= 2000; String year = String.valueOf(expYY); if (year.length() == 1) param.append("0"); param.append(year); param.append("&AMT=").append(p_mp.getPayAmt()); // Amount
List of PayFlow Pro supported transaction types but not yet implemented in ADempiere.
* Authorize - AuthorizationTransaction * Capture - CaptureTransaction * Credit - CreditTransaction * Void - VoidTransaction * Voice Authorization - VoiceAuthTransaction * Inquiry - InquiryTransaction
3. Common Test Cases
If you have opened your account to process American Express (AMEX), one dummy account for testing is 378282246310005 using 0000 as Verification Code. Also note that the PayPal sandbox treats all amount as US Dollar and will not process any single transaction exceeding $1,000.
Response = 0 for Approved Response = 12 for Declined - Run Standard Reports from PayPal Manager to retrieve or download Sales Transactions to investigate
Useful Links
PayPal Developer Central: https://developer.paypal.com/ Getting Started with PayPal's PayFlow Pro http://www.danvega.org/blog/index.cfm/2006/11/28/Getting-Started-With-PayPals-Payflow-Pro