Package paypal.payflow
Class PayflowAPI
java.lang.Object
paypal.payflow.PayflowAPI
PayflowAPI is used to submit a Name-value pair or XMLPay request to
PayPal payment gateway for online payment processing. The response
returned is the string value of the response from the PayPal payment
gateway.
// Create an instance of PayflowAPI.
PayflowAPI pa = new PayflowAPI();
//Sample Request.
// Please replace <user>, <vendor>, <password> & <partner>with your merchant information.
String request = "TRXTYPE=S&ACCT=5100000000000008&EXPDATE=0109&TENDER=C&INVNUM=INV12345&PONUM=PO12345&STREET=123 Main St.&ZIP=12345&AMT=12.25&USER=[user]&VENDOR=[vendor]&PARTNER=[partner]&PWD=[password]";
// RequestId is a unique string that is required for each and every transaction.
// The merchant can use her/his own algorithm to generate this unique request id or
// use the SDK provided API to generate this as shown below (PayflowAPI.generateRequestId).
String requestId = pa.generateRequestId();
String response = pa.submitTransaction(request,requestId);
* <p>
// Following lines of code are optional.
// Begin optional code for displaying SDK errors ...
// It is used to read any errors that might have occurred in the SDK.
// Get the transaction errors.
* <p>
String transErrors = pa.getTransactionContext().toString();
if (transErrors != null & transErrors.length() > 0)
{
System.out.println("Transaction Errors from SDK = \n" + transErrors);
}
.........................
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanFlag for Strong Assembly Transaction; -
Constructor Summary
ConstructorsConstructorDescriptionDefault Constructor.PayflowAPI(String hostAddress) PayflowAPI(String hostAddress, int hostPort) PayflowAPI(String hostAddress, int hostPort, int timeout) PayflowAPI(String hostAddress, int hostPort, int timeout, String proxyAddress, int proxyPort, String proxyLogon, String proxyPassword) PayflowAPI(String hostAddress, int hostPort, String proxyAddress, int proxyPort, String proxyLogon, String proxyPassword) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a header to the transactionThis function has been out in place to support generation of requestID from the COM Wrapper.Returns the ClientInfo contained by the class.protected booleanReturns the RequestId passed to the gateway.Returns the Transaction Context.This will have the errors generated during the transaction.Returns the request string for a Transaction.Returns the response string for a Transaction.Returns the version for the client.voidremoveTransHeader(String headerName) Removes a Transaction headervoidsetClientInfo(ClientInfo value) Sets the ClientInfo Object.protected voidsetIsXmlPayRequest(boolean value) submitTransaction(String paramList, String requestId) Submits a transaction to Payflow Server.
-
Field Details
-
isStrongAssemblyTransaction
public boolean isStrongAssemblyTransactionFlag for Strong Assembly Transaction;
-
-
Constructor Details
-
PayflowAPI
public PayflowAPI()Default Constructor. All the values will be picked up from the SDkProperties ,if specified. If this is not specified then the default values will be used. -
PayflowAPI
public PayflowAPI(String hostAddress, int hostPort, int timeout, String proxyAddress, int proxyPort, String proxyLogon, String proxyPassword) - Parameters:
hostAddress- StringhostPort- inttimeout- intproxyAddress- StringproxyPort- intproxyLogon- StringproxyPassword- String
-
PayflowAPI
- Parameters:
hostAddress- StringhostPort- String
-
PayflowAPI
public PayflowAPI(String hostAddress, int hostPort, String proxyAddress, int proxyPort, String proxyLogon, String proxyPassword) - Parameters:
hostAddress- StringhostPort- intproxyAddress- StringproxyPort- intproxyLogon- StringproxyPassword- String
-
PayflowAPI
- Parameters:
hostAddress- StringhostPort- inttimeout- int
-
PayflowAPI
- Parameters:
hostAddress- String
-
-
Method Details
-
getRequestId
Returns the RequestId passed to the gateway.- Returns:
- requestId String
-
getTransactionContext
Returns the Transaction Context.This will have the errors generated during the transaction.- Returns:
- transactionContext Context
-
getTransactionResponse
Returns the response string for a Transaction.- Returns:
- transactionResponse String
-
getTransactionRequest
Returns the request string for a Transaction.- Returns:
- transactionRequest String
-
getVersion
Returns the version for the client.- Returns:
- version String
-
getIsXmlPayRequest
protected boolean getIsXmlPayRequest()- Returns:
- isXmlpayRequest boolean
-
setIsXmlPayRequest
protected void setIsXmlPayRequest(boolean value) - Parameters:
value- boolean
-
getClientInfo
Returns the ClientInfo contained by the class.- Returns:
- clientInfo ClientInfo
-
setClientInfo
Sets the ClientInfo Object.- Parameters:
value- ClientInfo
-
submitTransaction
Submits a transaction to Payflow Server. PayflowAPI is used to submit a Name-value pair or XMLPay request to PayPal payment gateway for online payment processing. The response returned is the string value of the response from the PayPal payment gateway.- Parameters:
paramList- StringrequestId- String- Returns:
- response String
-
generateRequestId
This function has been out in place to support generation of requestID from the COM Wrapper.- Returns:
- requestId String
-
removeTransHeader
Removes a Transaction header- Parameters:
headerName- String
-
addHeader
Adds a header to the transaction- Parameters:
headerName- StringheaderValue- String
-