472,353 Members | 1,681 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Getting Error On PayPal

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
1 2318
jhardman
3,406 Expert 2GB
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

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

Similar topics

4
by: Chefry | last post by:
I'm trying to set up an off the shelf script and keep getting an error. My host set up the mysql on my site and I changed the variables I had to...
3
by: Stephane | last post by:
Hi, I'm trying to use PayPal and its Instant Payment Notification. In short, when a payment is made, PayPal send a post to my server and I post...
2
by: Tommy | last post by:
I have written some code to use paypal for users to make purchases from my site. I am using the paypal instant payment notification. When i get...
7
by: Alan Silver | last post by:
Hello, I've just been looking at the free PayPal component from ComponentOne and am somewhat amazed how insecure it is. They include all the...
0
by: PayPal Security Measures! | last post by:
<P><A href="http://www.paypal.com/cgi-bin/webscr?cmd=_home" target=_blank><IMG src="https://www.paypal.com/en_US/i/logo/paypal_logo.gif"...
4
by: lalith369100 | last post by:
Iam almost completed my project Now iam integrating paypal pro But While running sample programs it was showing error Message like this Error...
0
by: micahel | last post by:
Please chat with me by cnbbiz2008@hotmail.com to get the price and more photos, we take supplier paypal as payment. please see the photo album...
0
by: Nicodemus | last post by:
Do You Belive? \ cheapbbc@sina.com wrote in news:aecf26b6-4c75-4d87-b09c-a7380875e0f3 @w34g2000prm.googlegroups.com:
0
by: micahel | last post by:
Please chat with me by cnbbiz2008@hotmail.com to get the price and more photos, we take supplier paypal as payment. please see the photo album...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.