IPN response with 200 HTTP code but nothing in my database - php

I really need help because I don't know what to do at this point. I developed a website where the new user need to pay for sign up, I set the correct paypal form button and about the money everything works ok, the problem is that I can't update my database. I'm using these files (they are provided on gitHub and also in the official Paypal guide there's a link to them): "PaypalIPN.php" and "example_usage.php". I also added to my Ubuntu cloud server (where is my website) the cert/cacert.pem, I don't know if I had to do but in the first file seems to be required.
I tried to run a IPN simulator but it doesn't work, I looked for the same problem and I found that there may be a problem with the simulator, so I made some real transactions (I've read that live production test is run correctly with that code).
Therefore:
the transaction money is ok;
in the Instant payment notification history there are all test I made and in message ID I can read the correct data passed in the IPN message, the IPN type is "Transaction executed" and the response code is 200. I noticed that in "example_usage.php" the 200 response code was out of the if ($verified) so, just for my last test, I put that inside the if and yes, the response was again that;
I tried my code for update the mongodb database with fake data and obviously it works.
How is it possible? Please, help me and thank you.

Did you verify the correct URL is showing in the IPN History details? Sometimes people are using a button that uses notify_url to override the PayPal account setting, and then IPNs are working, but they're going to a different place than expected. So check that first.
If the IPN is indeed going to the URL you expect, and it's returning a 200 OK, that means it's receiving and completing the script successfully. If you aren't seeing the expected result in your database then you must have some sort of a logic problem with your code that needs to be addressed. You need to build in some trackers to log files or send yourself emails as it does each step of your script to see if that portion of code is actually getting hit like you think it is.
I put together this article for how to test PayPal IPN a while back that has proven helpful for many people. If you follow the steps there you should be able to track down the problem.

Related

PayPal successful transactions not recorded in dashboard (sandbox)

I've just uploaded the PayPal APIs to test my scripts, and so far, they seem to be working properly (all in sandbox mode). Payments are processed, and the transaction details are returned, but for some reason, the transactions are not being recorded on the PayPal dashboard.
I tried the IPN simulator, using the sample script from GitHub, but keep getting this error:
IPN was not sent, and the handshake was not verified.
The script works; at the very least, it writes a log file when called from any browser. But not when called from PayPal's IPN simulator.
Could really use some pointers in the right direction. TIA.
If you are HERE, then yes you "should" see them, however that dashboard is not very reliable. This is why I asked for clarity on 'what' dashboard you're looking at and posted the URL of sandbox.paypal.com.
If you're able to ping your IPN listener but PayPal is uanble to, try defining and enabling the IPN URL in the sandbox account and see what happens. From there you'll notice an IPN history link where you can see the status of the IPN call from that transction. If it failed, it will give you the error and you can troubleshoot from there.
Hope this helps

Processing Authorize.net relay response with PHP

I am kind of a newbie when it comes to online CC processing integration. I am in the Sandbox at Authorize.NET trying to configure my server to process SIM orders where the payment page form resides on the Authorize.net servers and processes the order. By default it looks like the confirmation is on their sites, and e-mails can be configured to be sent to the buyer and the seller. That is all working in the Sandbox. However, I am trying to capture some of the order and processing information on my server using the relay response. My processing page is accessible on my server, although I must say that I have .htaccess limited intermittently because it is still in development. I turn that off when I am testing.
The error that I am getting is:
An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.
This transaction has been approved.
It is advisable for you to contact the merchant to verify that you will receive the product or service.
I can't tell if they are POSTING data to my page or not, and I'm not really clear on what goes on the response page and how to parse the response. I am using the PHP SDK provided by Authorize.NET. The rest seems to be working. I am getting e-mails for the buyer and the seller and the order is proccessed but I'm not capturing the information on our server. What I would like to do is bypass their confirmation page, receive the relay response, create a custom confirmation and capture some of the data for our database. I'll keep digging because I made a fair amount of progress just reading the docs. This one is particularly useful.
Thanks.
I figured it out. There was an error on the page giving a "500" error. I have to say, it is a little strange the way they have it set up. They are POSTING to my page, where I am capturing the POST data, writing stuff to a database, and then creating a custom confirmation message, although it must be via a header redirect because it shows up on their server (their domain is in the address bar). It all works, but apparently, any SESSION variable values are not available to my script in that case?

Paypal ION different servers

so I got a guy to code this IPN feature for my website.
Basically a user pays thought the main site then it forwards the ipn stuff to another server and that server sends ipn payment to paypal. For some reason it keeps saying "retrying" under the paypal IPN history. Is paypal blocking this and does the payment have to be made from the same server? Thanks hopefully this makes sense!
IPN does not happen until after any transaction has occurred, so what you're saying here doesn't really make sense. There's no way IPN would be sending any payment to PayPal. PayPal simply POSTs transaction data to your IPN URL after the transaction has taken place.
That said, if you're seeing "retrying" in your IPN History that means your IPN script is not completing successfully, and as such, is not returning a 200 result code back to PayPal's server. You need to troubleshoot your IPN script to figure out what's failing and get it fixed.
Your web server logs should provide the information you need. If you look there you should see a log of when your IPN URL was hit and it should also provide the result including any errors that were generated from the request to that script.
I like to create a simple HTML form with the action set to my IPN URL and then include hidden fields that match the fields/values that I would expect to get from IPN. This way you can load that in a browser and submit it directly so that you can see the result on screen which can help with troubleshooting and debugging.
Keep in mind that when testing that way, though, the data is not coming from PayPal's servers, so it will not verify. You'll need to make sure your script is setup to handle this accordingly for testing purposes.

PayPal cannot process this transaction because of seller's website

After successful Sandbox testing for Website Payments Standard, I'm going live now. When I click on a "Buy Now" button, I should be able to see a page that shows me the total quantity on the left, and allows me to log in using PayPal on the right.
But I just get the following page, which also says "Test Site" at the top, although I'm no longer referring to the sandbox:
The error is: Paypal cannot process this transaction because of a problem with the seller's website.
I've done the following things:
Made sure I've changed the API endpoints to live production (basically, eliminate "sandbox" from the URLs.
Made sure I'm using the seller API crendentials from my seller account (not sandbox test API).
I'm using an IPN listener and have set $listener->user_sandbox to false (although I don't think the listener is even loaded yet at this stage).
By the way, if it matters, I'm using PayPal's ButtonManagerAPI to dynamically create hosted buttons, and I'm using NVP API calls with PHP. Everything worked as expected in the sandbox. This was my relevant API code:
"METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature&BUTTONCODE=HOSTED&BUTTONTYPE=BUYNOW&L_BUTTONVAR1=amount=".$usd_total
I tested your API request against my account and it is working correctly. It correctly generates a button, and then I am able to go through with a buyer account and make a purchase, so it looks like the issue is with the account you are using to generate the button. Can you provide either the test sandbox email, or the merchant id for the account that you generated the test sandbox credentials from so that I can take a look at the account and see what the issue may be?
I was getting the same error message until I removed the ng-model reference (angularJS) in the button html code.
I was actually getting this issue from simply not having the correct product ID in the form. Once I updated that it worked for me.
Hope this helps!

How can I automatically alert my php/mysql web app that a PayPal transaction has gone through?

I have a client who will be selling access to an online service on their website. They would like to integrate a PayPal Buy Now button into the site... no problems there. However, they want their customers to have instant access to the online service that they are selling as soon as the payment is processed. That seems reasonable to me... the problem is that I can't seem to find a way to automate that. So my question is really this:
How can I automatically alert my php/mysql web app that a PayPal transaction has gone through?
All I would really need is like a callback process that triggers a php script to updates the customer's record in the database... right? Seems simple to me. But I can't seem to find a way to do it! Anyway, if you've accomplished anything similar with PayPal, I'd be grateful for your advice!
See Instant Payment Notification.
I think you want to send in a variable to paypal (item_number) that they will return to a page that you specify in your post to them (return - success and cancel_return - cancel). They will send you back whether the transaction was successful or not and then with your variable you can make a call to your db to update the record in your database based upon the result of the transaction. In the return page you can also send some sort of notification to the client of the success or failure of the payment process and clean up after a canceled transaction.
PayPal maintains an extensive knowledge base on how to integrate their services with your web app. In think that is a good first starting point. See www.x.com

Categories