Class PayflowAPI

java.lang.Object
paypal.payflow.PayflowAPI

public class PayflowAPI extends Object
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 Details

    • isStrongAssemblyTransaction

      public boolean isStrongAssemblyTransaction
      Flag 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 - String
      hostPort - int
      timeout - int
      proxyAddress - String
      proxyPort - int
      proxyLogon - String
      proxyPassword - String
    • PayflowAPI

      public PayflowAPI(String hostAddress, int hostPort)
      Parameters:
      hostAddress - String
      hostPort - String
    • PayflowAPI

      public PayflowAPI(String hostAddress, int hostPort, String proxyAddress, int proxyPort, String proxyLogon, String proxyPassword)
      Parameters:
      hostAddress - String
      hostPort - int
      proxyAddress - String
      proxyPort - int
      proxyLogon - String
      proxyPassword - String
    • PayflowAPI

      public PayflowAPI(String hostAddress, int hostPort, int timeout)
      Parameters:
      hostAddress - String
      hostPort - int
      timeout - int
    • PayflowAPI

      public PayflowAPI(String hostAddress)
      Parameters:
      hostAddress - String
  • Method Details

    • getRequestId

      public String getRequestId()
      Returns the RequestId passed to the gateway.
      Returns:
      requestId String
    • getTransactionContext

      public Context getTransactionContext()
      Returns the Transaction Context.This will have the errors generated during the transaction.
      Returns:
      transactionContext Context
    • getTransactionResponse

      public String getTransactionResponse()
      Returns the response string for a Transaction.
      Returns:
      transactionResponse String
    • getTransactionRequest

      public String getTransactionRequest()
      Returns the request string for a Transaction.
      Returns:
      transactionRequest String
    • getVersion

      public 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

      public ClientInfo getClientInfo()
      Returns the ClientInfo contained by the class.
      Returns:
      clientInfo ClientInfo
    • setClientInfo

      public void setClientInfo(ClientInfo value)
      Sets the ClientInfo Object.
      Parameters:
      value - ClientInfo
    • submitTransaction

      public String submitTransaction(String paramList, String requestId)
      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 - String
      requestId - String
      Returns:
      response String
    • generateRequestId

      public String generateRequestId()
      This function has been out in place to support generation of requestID from the COM Wrapper.
      Returns:
      requestId String
    • removeTransHeader

      public void removeTransHeader(String headerName)
      Removes a Transaction header
      Parameters:
      headerName - String
    • addHeader

      public void addHeader(String headerName, String headerValue)
      Adds a header to the transaction
      Parameters:
      headerName - String
      headerValue - String