Getting Started With PayPal's Payflow Pro Part II

Word Count: 454

I just realized that in my last post I did not explain what to do after you make the call using the Payflow Pro tag. The query attribute in the tag is the variable you will use to parse out the result. The query variable will return a query with the following values.

  • #Queryname.resultstr# gives the full, exact response from the server. For example, if you passed QUERY = “Transaction” to the ColdFusion CFX_PayFlowPro tag, then you could refer to the data as #Transaction.resultstr# in your ColdFusion script.
  • #Queryname.resultstr# includes name/value pairs that can be referenced by name. For example, if #Transaction.resultstr# returned RESULT=0&RESPMSG=Approved&PNREF=V6000000, then you could reference the name value pairs using #Transaction.result#, #Transaction.respmsg#, and #Transaction.pnref# respectively.
Additional name/value pairs that are not contained within the resultstr include:
  • #Queryname.parmlist# Returns the entire string passed to the server in the attempt to process a transaction.
  • #Queryname.version# Returns the version of the SDK used to process the transaction. This is useful when requesting support from PayPal.
Any logic to interpret results can use standard ColdFusion functions. To fully understand the transaction process, see Payflow Pro Developer’s Guide.

Below is an example of how I parse out the result to email myself based on the result.

<cfoutput query="result">
<cfif respmsg eq "approved">
   <!--- approved --->
   <!--- Your order was approved. --->
   <cfmail to="#toemail#" from="#fromemail#" subject="Order Approved." type="HTML">
      <strong>Auth Code:</strong> <br>
      <strong>PNREF:</strong>    #pnref#<br>
      <strong>RESPMSG:</strong> #respmsg#<br>
      <strong>Result:</strong>   #result#<br>
      <strong>Version:</strong> #version#<br>
      <strong>ParamList:</strong> #parmlist#<br>
      <strong>ResultStr:</strong> #resultstr#<br>
      <hr/>
   </cfmail>
<cfelse>
   <cfset commit = false>
   <!--- denied, the message will be diplayed on the checkout page --->
   <cfmail to="#toemail#" from="#fromemail#" subject="Order declined." type="HTML">   
      <strong>RESPMSG:</strong> #respmsg#<br>
      <strong>Result:</strong>   #result#<br>
      <strong>Version:</strong> #version#<br>
      <strong>ParamList:</strong> #parmlist#<br>
      <strong>ResultStr:</strong> #resultstr#<br>
      <hr/>   
      <cfloop list="#parmlist#" delimiters="&" index="key">
         #key#<br>
      </cfloop>
   </cfmail>
</cfif>
</cfoutput>

Comments



Post Your Comment

Leave this field empty







Show Captcha

If you subscribe, any new posts to this thread will be sent to your email address.

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.