By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,855 Members | 1,838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,855 IT Pros & Developers. It's quick & easy.

Getting Error On PayPal

P: 1
Any one who tell me what’s wrong with this code. When I pass values to pay pal by using www.sandbox.paypal.com/cgi-bin/webscr all the code are working well.
The orders are generating accurately. The code after returning from paypal is as follows.
Expand|Select|Wrap|Line Numbers
  1. <!--#include file="../includes/connection1.asp"-->
  2. <!--#include file="Cart_Include.asp"-->
  3. <%
  4. ' read post from PayPal system and add 'cmd'
  5. str ="cmd=_notify-validate&"& Request.QueryString 
  6. ' post back to PayPal system to validate
  7. set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
  8. 'objHttp.open "POST", "https://www.sandbox.paypal.com/cgi-bin/webscr", false
  9. objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
  10. objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
  11. objHTTP.setRequestHeader "Content-Length", Len(str)
  12. objHttp.Send str
  13.     if (objHttp.status <> 200 ) then
  14.        ' HTTP error handling
  15.        Response.write "An Error Occured"
  16.     elseif (objHttp.responseText = "VERIFIED") then
  17.       if request("Payment_Status") ="Completed" then
  18.        orderstatus=2
  19.        msg="error=Congratuation, Your Credits has been upgrated 
  20.                    successfully"
  21.       else
  22.        orderstatus=1
  23.        msg="error=Your Payment status is Pending, As Soon as it                 is verified we will send you a confirmation Email."
  24.     end if
  25.      set rs=server.createobject("adodb.recordset")
  26.      sql="select * from orders"
  27.      rs.open sql,conn,3,3
  28.      rs.addnew
  29.      rs("order_price")=request("mc_gross")
  30.      rs("contactname")=request("first_name") & " "& request
  31.                  ("last_name")
  32.      rs("address")=request("address_street")
  33.      rs("city")=request("address_city")
  34.      rs("country")=request("address_country")
  35.      rs("zip")=request("address_zip")
  36.      rs("order_quantity")=request("custom")
  37.      rs("order_status")=orderstatus
  38.      rs("email")=request("payer_email")
  39.      rs("order_date")=paymentdate
  40.      rs.update
  41.      set rs=nothing
  42.                  Call InsetOrderDetails()
  43.      response.Redirect("mesg.asp?"& msg)
  44.                else
  45.                  response.Redirect("mesg.asp?error=Error on receiving information, please contact to Admin")
  46.                end if
  47.  
But the problem become when i send data by using
www.paypal.com/cgi-bin/webscr. after receiveing data from paypal the else statement are execute such as

response.Redirect("mesg.asp?error=Error on receiving information, please contact to Admin").

The orders are not generating by using www.paypal.com/cgi-bin/webscr.

Please Help Me.
Thank You
Mehtab Khan.
Mar 31 '08 #1
Share this Question
Share on Google+
1 Reply


jhardman
Expert 2.5K+
P: 3,405
I usually check for error using the method
Expand|Select|Wrap|Line Numbers
  1. on error resume next
  2. ...
  3. if err.number <> 0 then %>
  4.    An error occurred. <br> Please notify <a
  5.    href="mailto:me@address.com">webmaster</a> if error continues.
  6.    error# <%=err.number%>: <%=err.description%> 
  7.    <% err.clear
  8. else 
  9.    'do your magic here
  10. end if %>
Try this method, let me know if it gives you a different output.

Jared
Apr 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.