2

I have Integrated Paypal using php. I know there is return url ,that means when payment is received it will return to the url for our website.
My Question is if payment is received and due to internet problem it does not return to our web page, how do I know that payment is received from a particular user?

Abhinav Singh Maurya
  • 3,313
  • 8
  • 33
  • 51

6 Answers6

4

If there is a network issue and PayPal cannot issue the IPN message, then according to their documentation, they will retry 15 times up to 4 days.

The IPN message service does not assume that your listener will receive all IPN messages. Because the Internet is not 100% reliable, IPNs can get lost or be delayed. To address these issues, the IPN message service includes a retry mechanism that re-sends a message at various intervals until your listener acknowledges receipt. An IPN message may be present up to four days after the original was sent. The maximum number of retries is 15.

https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/

ʰᵈˑ
  • 11,279
  • 3
  • 26
  • 49
2

This item below might help. Instant Payment Notification should work, but in the case of a network failure, if the payment reached PayPal but the purchaser did not get back to your site to complete a purchase, then you should still receive an email from PayPal telling you that you have received a payment.

using paypal button - can my webpage tell if paypal transaction was successful or not?

You get a confirmation email with their name and email address - be aware that occasionally this may not be the user's current, most active email address. You can also log in to your PayPal dashboard to see all details as well, of course.

You can look up your payment details from the email and compare them to your own user records in your database. If the email they use for PayPal is not the same as the one they registered on your site with, you can still look up their name from the email - in practice it seems to happen extremely rarely that payments have such a problem in my personal experience

I set up a script which emails my users with a passcode to get to the online product they bought which is emailed to them so they can submit that later along with their email address. This is the first thing that happens on return to my script so at least if the site fails to respond properly they can get to what they bought later.

The script uses PHPMailer and cc's me with their passcode so I have it available to re-send to them if they write with a complaint. It doesn't help if the PayPal return for Instant Payment Notification fails completely but the other answers cover that very fully and detail the PayPal repeat attempt process well.

Instant Payment Notification scripts can be downloaded from PayPal for modification by yourself as per the article linked to above.

Steve
  • 808
  • 1
  • 9
  • 14
1

To be perfectly honest, this is one of PayPal Standard's largest holes. IPN is a POST callback (as is PDT) and they check to make sure they get a 200 response or else they retry (and you can use the IPN history in your PayPal account to resend missing IPNs). But this method still relies on you getting the callback in a timely manner and it's not foolproof. Worse, you need to verify the IPN call and that introduces yet another point of failure in calling PayPal to make sure they did indeed send you the IPN you got.

There's a couple of ways to deal with this

  1. Audit your account regularly. This is a good idea in general, but for a small website this shouldn't be terribly hard. Match your invoices up to your PayPal payments. Obviously this doesn't scale well so...
  2. Switch to Payments Pro. There's more hurdles to this (like more PCI compliance, SSL certificate, etc) but the major advantage is that the API is far less susceptible to the whims of the Internet and only involves one call for credit cards (you can ignore the IPN because the API tells you everything you need to know). The worst that can happen is you send a payment API call and fail to get a response. This is exceptionally rare as PayPal makes sure their API is 99.9% reliable (IPN relies on your server being reliable). Speaking from experience, Payments Pro has far fewer issues than IPN does.
Machavity
  • 30,841
  • 27
  • 92
  • 100
0

In your application, you should have a status field for orders. If you haven't received the ipn, you wouldn't change the status to Paid.

After that, if you receive an email from Paypal that someone has paid, check the order number, and change the status manually.

how do I know that payment is received from a particular user?

Paypal will send an email both user and you.

0

Paypal offers 2 solutions for your problem.

  1. PayPal IPN - it notifies the server with a POST request to a specific URL, whena transaction has been successful, declined, aborted by user and so on. Paypal provide an IPN Simulator (the worst simulator ever) in order to test its functionality. you may give it a try at : https://developer.paypal.com/developer/ipnSimulator/
  2. Paypal WebHooks - The webhooks are the "New Kid in the Block",they are basically "user-defined HTTP callbacks that receive events for the subscribed event types. Webhooks are asynchronous, the order is not guaranteed, and idempotency may lead to the same event being sent more than once." as stated in the Paypal documentation. You can read more about it on : https://developer.paypal.com/docs/integration/direct/rest-webhooks-overview/

For any further help, comment below and I shall try to help.

Cheers,

Noxymon
  • 201
  • 4
  • 15
-1

You have to use notify_url for this purpose

<input type="hidden" name="notify_url" value="https://domain-name.com/ipn.php">
Atif Tariq
  • 2,650
  • 27
  • 34