Class AuthorizationTransaction

java.lang.Object
paypal.payflow.BaseTransaction
paypal.payflow.AuthorizationTransaction
Direct Known Subclasses:
OrderTransaction

public class AuthorizationTransaction extends BaseTransaction
This class is used to create and perform an Authorization Transaction. *

A successful authorization needs to be captured using a capture transaction.

This example shows how to create and perform an authorization transaction. *

.......... .......... //Populate required data objects. .......... .......... *

//Create a new Authorization Transaction. AuthorizationTransaction trans = new AuthorizationTransaction( userInfo, PayflowConnectionData, invoice, Tender, RequestId); //Submit the transaction. trans.submitTransaction(); *

// Get the Response. Response resp = trans.getResponse(); if (Resp != null) { // Get the Transaction Response parameters. TransactionResponse trxnResponse = Resp.getTransactionResponse(); if (trxnResponse != null) { System.out.println("RESULT = " + trxnResponse.getResult()); System.out.println("PNREF = " + trxnResponse.getPnref()); System.out.println("RESPMSG = " + trxnResponse.getRespMsg()); System.out.println("AUTHCODE = " + trxnResponse.getAuthCode()); System.out.println("AVSADDR = " + trxnResponse.getAVSAddr()); System.out.println("AVSZIP = " + trxnResponse.getAVSZip()); System.out.println("IAVS = " + trxnResponse.getIAVS()); } // Get the Fraud Response parameters. FraudResponse fraudResp = resp.getFraudResponse(); if (fraudResp != null) { System.out.println("PREFPSMSG = " + fraudResp.getPreFpsMsg()); System.out.println("POSTFPSMSG = " + fraudResp.getPostFpsMsg()); } } // Get the Context and check for any contained SDK specific errors. Context ctx = resp.getTransactionContext(); if (ctx != null ++ ctx.getErrorCount() %3E 0) { System.out.println("Errors = " + ctx.toString()); }

  • Constructor Details

    • AuthorizationTransaction

      public AuthorizationTransaction(UserInfo userInfo, PayflowConnectionData payflowConnectionData, Invoice invoice, BaseTender tender, String requestId)
      Constructor.
      Parameters:
      userInfo - User Info object populated with user credentials.
      payflowConnectionData - Connection credentials object.
      invoice - Invoice object.
      tender - Tender object.
      requestId - Request Id. This example shows how to create and perform a authorization transaction. *

      .......... .......... //Populate required data objects. .......... .......... *

      //Create a new Authorization Transaction. AuthorizationTransaction Trans = new AuthorizationTransaction( userInfo, PayflowConnectionData, invoice, Tender, RequestId); //Submit the transaction. trans.submitTransaction(); *

      // Get the Response. Response resp = trans.getResponse(); if (Resp != null) { // Get the Transaction Response parameters. TransactionResponse trxnResponse = resp.transactionResponse(); if (trxnResponse != null) { System.out.println("RESULT = " + trxnResponse.getResult()); System.out.println("PNREF = " + trxnResponse.getPnref()); System.out.println("RESPMSG = " + trxnResponse.getRespMsg()); System.out.println("AUTHCODE = " + trxnResponse.getAuthCode()); System.out.println("AVSADDR = " + trxnResponse.getAVSAddr()); System.out.println("AVSZIP = " + trxnResponse.getAVSZip()); System.out.println("IAVS = " + trxnResponse.getIAVS()); } // Get the Fraud Response parameters. FraudResponse fraudResp = resp.getFraudResponse(); if (FraudResp != null) { System.out.println("PREFPSMSG = " + fraudResp.getPreFpsMsg()); System.out.println("POSTFPSMSG = " + fraudResp.getPostFpsMsg()); } }

    • AuthorizationTransaction

      public AuthorizationTransaction(UserInfo userInfo, Invoice invoice, BaseTender tender, String requestId)
      Constructor.
      Parameters:
      userInfo - User Info object, populated with user credentials.
      invoice - Invoice object.
      tender - Tender object
      requestId - String Request Id This example shows how to create and perform a authorization transaction. *

      .......... .......... //Populate required data objects. .......... .......... *

      // Create a new Authorization Transaction. AuthorizationTransaction Trans = new AuthorizationTransaction(userInfo, PayflowConnectionData, Invoice, Tender, RequestId); //Submit the transaction. trans.submitTransaction();

      // Get the Response. Response resp = trans.getResponse(); if (Resp != null) { // Get the Transaction Response parameters. TransactionResponse trxnResponse = resp.transactionResponse(); if (trxnResponse != null) { System.out.println("RESULT = " + trxnResponse.getResult()); System.out.println("PNREF = " + trxnResponse.getPnref()); System.out.println("RESPMSG = " + trxnResponse.getRespMsg()); System.out.println("AUTHCODE = " + trxnResponse.getAuthCode()); System.out.println("AVSADDR = " + trxnResponse.getAVSAddr()); System.out.println("AVSZIP = " + trxnResponse.getAVSZip()); System.out.println("IAVS = " + trxnResponse.getIAVS()); } // Get the Fraud Response parameters. FraudResponse fraudResp = resp.getFraudResponse(); if (fraudResp != null) { System.out.println("PREFPSMSG = " + fraudResp.getPreFpsMsg()); System.out.println("POSTFPSMSG = " + fraudResp.getPostFpsMsg()); } } // Get the Context and check for any contained SDK specific errors. Context ctx = resp.getTransactionContext(); if (ctx != null && ctx.getErrorCount() %3E 0) { System.out.println("Errors = " + ctx.ToString()); }

    • AuthorizationTransaction

      protected AuthorizationTransaction(String trxType, UserInfo userInfo, PayflowConnectionData payflowConnectionData, Invoice invoice, BaseTender tender, String requestId)
      constructor to be used in case of basic and order auth
      Parameters:
      trxType - String
      userInfo - userInfo
      payflowConnectionData - PayflowConnectionData
      invoice - String
      tender - String
      requestId - String
    • AuthorizationTransaction

      protected AuthorizationTransaction(String trxType, UserInfo userInfo, Invoice invoice, BaseTender tender, String requestId)
      Parameters:
      trxType - String
      userInfo - userInfo
      invoice - Invoice
      tender - BaseTender
      requestId - String
  • Method Details

    • getOrigId

      public String getOrigId()
    • setOrigId

      public void setOrigId(String origId)
      the origId to set.
      Parameters:
      origId - String
    • getPartialAuth

      public String getPartialAuth()
      Gets, Sets partialAuth. This property is used to notify banks that a partial authorization can be performed for a pre-paid debit/gift card. *

      Partial Approval is supported for Visa, MasterCard, American Express and Discover (JCB (US Domestic only), and Diners) Prepaid card products such as gift, Flexible Spending Account (FSA) or Healthcare Reimbursement Account (HRA) cards. In addition Discover (JCB (US Domestic only), and Diners) supports partial Approval on their consumer credit card. It is often difficult for the consumer to spend the exact amount available on the prepaid account, as the purchase can be for amounts greater than the value available. This can result in unnecessary declines. Visa, MasterCard, American Express and Discover (JCB (US Domestic only), and Diners) recognize that the prepaid products represent unique opportunities for both merchants and consumers. With Partial Approval issuers may approve a portion of the amount requested. This will enable the residual transaction amount to be paid by other means. The introduction of the partial approval capability will reduce decline frequency and enhance the consumer and merchant experience at the point of sale. Merchants will now have the ability to accept partial approval rather than having the sale declined. *

      Returns:
      partialAuth String This example shows how to set the flag to support partial authorizations. .......... .......... //Populate required data objects. .......... .......... *

      //Create a new Authorization Transaction. AuthorizationTransaction trans = new AuthorizationTransaction(userInfo, PayflowConnectionData, invoice, Tender, RequestId); // Flag the transactions to allow partial authorizations // of pre-paid credit cards. trans.setPartialAuth("Y"); *

      //Submit the transaction. trans.submitTransaction(); *

      // Get the Response. Response resp = trans.getResponse(); if (resp != null) { // Get the Transaction Response parameters. TransactionResponse trxnResponse = resp.getTransactionResponse(); if (trxnResponse != null) { System.out.println("RESULT = " + trxnResponse.getResult()); System.out.println("PNREF = " + trxnResponse.getPnref()); System.out.println("RESPMSG = " + trxnResponse.getRespMsg()); System.out.println("AUTHCODE = " + trxnResponse.getAuthCode()); System.out.println("AVSADDR = " + trxnResponse.getAVSAddr()); System.out.println("AVSZIP = " + trxnResponse.getAVSZip()); System.out.println("IAVS = " + trxnResponse.getIAVS()); } // Get the Fraud Response parameters. FraudResponse fraudResp = resp.getFraudResponse(); if (fraudResp != null) { System.out.println("PREFPSMSG = " + fraudResp.getPreFpsMsg()); System.out.println("POSTFPSMSG = " + fraudResp.getPostFpsMsg()); } }

    • setPartialAuth

      public void setPartialAuth(String partialAuth)
      the partialAuth to set.
      Parameters:
      partialAuth - String
    • getCreateSecureToken

      public String getCreateSecureToken()
      Gets, Sets CreateSecureToken, SecureTokenId. This property is used to create a SecureToken and SecureTokenId. *

      Use a secure token to send non-credit card transaction data to the Payflow server for storage in a way that can't be intercepted and manipulated maliciously.The secure token must be used with the hosted checkout pages. The token is good for a one-time transaction and is valid for 30 minutes. *

      NOTE: Without using a secure token, Payflow Pro merchants can host their own payment page and Payflow Link merchants can use a form post to send transaction data to the hosted checkout pages. However, by not using the secure token, these Payflow gateway users are responsible for the secure handling of data. To obtain a secure token, pass a unique, 36-character token ID and set CREATESECURETOKEN=Y in a request to the Payflow server. The Payflow server associates your ID with a secure token and returns the token as a string of up to 32 alphanumeric characters. To pass the transaction data to the hosted checkout page, you pass the secure token and token ID in an HTTP form post. The token and ID trigger the Payflow server to retrieve your data and display it for buyer approval. *

      Returns:
      secureToken String This example shows how to set the flag to create a secure token. .......... .......... //Populate required data objects. .......... .......... *

      // Since we are using the hosted payment pages, you will not be sending the credit card data with the // Secure Token Request. You just send all other 'sensitive' data within this request and when you // call the hosted payment pages, you'll only need to pass the SECURETOKEN; which is generated and returned // and the SECURETOKENID that was created and used in the request. *

      // Create a new Secure Token Authorization Transaction. Even though this example is performing // an authorization, you can create a secure token using SaleTransaction too. Only Authorization and Sale // type transactions are permitted. AuthorizationTransaction Trans = new AuthorizationTransaction(User, Connection, Inv, PayflowUtility.RequestId); *

      // Set the flag to create a Secure Token. Trans.CreateSecureToken = "Y"; // The Secure Token Id must be a unique id up to 36 characters. Using the RequestID object to // generate a random id, but any means to create an id can be used. Trans.SecureTokenId = PayflowUtility.RequestId; *

      //Submit the transaction. trans.submitTransaction(); *

      // Get the Response. Response resp = trans.getResponse(); if (resp != null) { // Get the Transaction Response parameters. TransactionResponse trxnResponse = resp.getTransactionResponse(); if (trxnResponse != null) { System.out.println("RESULT = " + trxnResponse.getResult()); System.out.println("RESPMSG = " + trxnResponse.getRespMsg()); System.out.println("SECURETOKEN = " + trxnResponse.getSecureToken()); System.out.println("SECURETOKENID = " + trxnResponse.getSecureTokenId()); } }

    • getSecureTokenId

      public String getSecureTokenId()
    • setCreateSecureToken

      public void setCreateSecureToken(String createSecureToken)
      the createSecureToken is set.
      Parameters:
      createSecureToken - String
    • setSecureTokenId

      public void setSecureTokenId(String secureTokenId)
      the secureTokenId is set.
      Parameters:
      secureTokenId - String
    • generateRequest

      protected void generateRequest()
      Generates the transaction request.
      Overrides:
      generateRequest in class BaseTransaction