<% '---------------------------------------------------------------------- 'PayPal Express Checkout Example Step 2 '================================================ 'Display the resulting authorization details from 'PayPal on a PayPal payment, and complete the 'payment authorization. This script would be called 'when the buyer returns from PayPal and has authorized 'the payment '---------------------------------------------------------------------- On Error Resume Next Dim resArray Dim reqArray Dim message Set resArray = SESSION("nvpResArray") set conn = Server.Createobject("adodb.connection") set rs = server.createobject("adodb.recordset") conn.open connstr if session("orderid") = "" then orderid="0" else orderid = session("orderid") end if if orderid = "0" then session("errmsg")="Your shopping cart is empty" response.redirect "http://www.spiritfitness.com/shop/form.asp" else rs.open "select * from orders where id = " & orderid, conn,3,3 if rs.eof then rs.close conn.close session("errmsg")="Order has not been created, can't update, please try again" response.redirect "http://www.spiritfitness.com/shop/abandon.asp" end if if rs("approved") then rs.close conn.close session("errmsg")="Order has been completed and paid for, can't update" response.redirect "http://www.spiritfitness.com/shop/abandon.asp" end if end if rs("shippingname")=resArray("FIRSTNAME") & " " & resArray("LASTNAME") rs("shippingaddress1")=resArray("SHIPTOSTREET") rs("shippingaddress2")="" rs("shippingcity")=resArray("SHIPTOCITY") rs("shippingstate")=resArray("SHIPTOSTATE") rs("shippingzip")=resArray("SHIPTOZIP") rs("shippingcountry")=resArray("SHIPTOCOUNTRYNAME") rs("email")=resArray("EMAIL") rs("ordertotal")= SESSION("paymentAmount") rs("subtotalprice")= SESSION("paymentAmount") rs.update rs.close conn.close '---------------------------------------------------------------------- 'Collect the necessary information to complete the 'authorization for the PayPal payment '---------------------------------------------------------------------- token = SESSION("token") currCodeType = SESSION("currencyCodeType") paymentAmount = SESSION("paymentAmount") paymentType = SESSION("PaymentType") payer_id = SESSION("PayerID") '---------------------------------------------------------------------- 'Set the final URL to complete the authorization. The 'link will be displayed at the bottom the the browser for this 'example. The link would normally be displayed at the end of your checkout 'and would finalize payment when clicked. '---------------------------------------------------------------------- final_url ="DoExpressCheckoutPayment.asp?token=" & token &_ "&payerID="& payer_id &_ "&paymentAmount="& paymentAmount &_ "&currCodeType="& currCodeType &_ "&paymentType=" &paymentType message = "Get Express checkout Details!" '---------------------------------------------------------------------- 'Display the API request and API response back to the browser using Diaplay.asp. 'If the response from PayPal was a success, display the response parameters 'If the response was an error, display the errors received '---------------------------------------------------------------------- %>
Order Confirmation
   
Order Total: <%=currCodeType%> <%=formatcurrency(paymentAmount)%>
 
Shipping To
   
Name: <%=resArray("FIRSTNAME")%> <%=resArray("LASTNAME")%>
Street 1: <%=resArray("SHIPTOSTREET")%>
Street 2:
City: <%=resArray("SHIPTOCITY")%>
State: <%=resArray("SHIPTOSTATE")%>
Zip code: <%=resArray("SHIPTOZIP")%>
Country: <%=resArray("SHIPTOCOUNTRYNAME")%>

<% If Err.Number <> 0 Then SESSION("ErrorMessage") = ErrorFormatter(Err.Description,Err.Number,Err.Source,"GetExpressCheckoutDetails.asp") Response.Redirect "APIError.asp" Else SESSION("ErrorMessage") = Null End If %>