Getting Started With PayPal's Payflow Pro Part II
Wednesday November 29, 2006 12:45 PM
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.
- #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.
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>
<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>
