What happens when a PayPal subscription is cancelled or fails? - paypal

I am thinking about using PayPal to take subscription payments for a website but have a question relating to the process of cancelling and failed payments.
Initial process:
Click subscribe/buy now button
Log into PayPal or enter card details
Review, click confirm
Completion page (with PDT)
3 months and 2 days later and the user logs into PayPal to cancel their subscription (within PayPal instead of using my website).
How is that process or information passed back to my website for cancelled or failed subscription?
I haven't found anything in FAQ, Help or How to and Louise was useless. I hope that someone here can help me...
Manually, I assume we're expected to log in review History and update the website accordingly (every couple of days).
Many thanks,
Simon

You would set up an IPN listener in your PayPal Profile. Once a subscription or recurring payments is charged, skipped, suspended or cancelled, you'll receive an appropriate IPN message at your IPN listener URL.
For IPN sample code and documentation, take a look at https://www.paypal.com/ipn, and for the individual IPN variables, take a look at https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables

Related

Is there any option in Paypal seller sandbox account to accept the pending payments?

Im working on moodle paypal enrollment feature. I saw that lessons were not getting enrolled to the student even after the successful paypal payemnt. Because the Paypal 'Payment review' setting was set to ON so all the payments are were in pending. I have turned OFF that setting. now I can see the payment complete.
but I do not see an option to accept the 'pending' transaction in sandbox/developer account as seller? Also when seller approves the payment will it trigger IPN simulator and update the payment status to my website?
When payment accepted manually will that call IPN url http://example.com.com/availability/condition/paypal/ipn.php for moodle lessons?
please help me
The Payment Review feature identifies high-risk transactions and notifies merchants of the review so they can hold shipments until PayPal has evaluated the transaction risk.
Yes, you will receive one more notification, when the transaction review will be resolved.
With status:
payment_status: Completed (If the transaction succeeded and the payment was accepted)
payment_status: Reversed (If the transaction failed and the payment was rejected)
You'll find all the notifications here:
https://www.sandbox.paypal.com/de/cgi-bin/webscr?cmd=_display-ipns-history
My understanding is that you just can't any more. I took this up with PayPal when they redesigned the Transaction Details screen because in the old version, there were indeed Accept/Deny actions as the help page that Ivan has provided a link to.
The support rep's response was "yes, this is an omission which I'll take up with development. For now, you can use the old interface, where you should find those options".
Now, that's probably 2 or more years ago (say 2019) and I haven't seen these Accept/Deny options appear in any transaction details page in the current version, and now there's no option to revert to the old version which did have them.
As a developer, I find PayPal's UI and feature set a set of moving goalposts that it's nigh on impossible to keep up with. I now can't even access my old support tickets to find out what the exact response was. I personally detest the platform.

Paypal IPN not firing?

I have a question about Paypal IPN, I was wondering when does the IPN activate and send it's message to my website.
I currently have my website that has a buy button. When the client buy the service, he is directed to paypal. Once he pay the service, nothing happen. In order for me to receive the IPN notification, the user has to click "Return to merchant website" or whatever the link is, then I receive the IPN notification.
Is it normal, does it work like that for everyone?
Cause right now, most people when they are done with the payment, just close the website and I don't receive any notification.
Thanks for any help !
Your question leaves a lot of missing information so I will go through each option for you:
Read here about how to setup a sandbox account if you don't already have one: https://developer.paypal.com/docs/classic/lifecycle/sb_create-accounts/
Bare in mind that your sandbox account is entirely separate in every way from your live paypal account. All settings will need to be checked and customised as needed.
Set up your IPN URL on your sandbox account Here: https://www.sandbox.paypal.com/uk/cgi-bin/webscr?cmd=_profile-ipn-notify
Once set up, you then need to download and set your code (PHP or something else) to the listener (referenced in the above sandbox profile link). You can find IPN code examples here: https://github.com/paypal/ipn-code-samples
When that's all set you need to set your listener to using the sandbox mode and then log in to your live account and then run the IPN simulator from here: https://developer.paypal.com/developer/ipnSimulator/
Paypal will send messages to your IPN listener and you need to do something with the messages, typically output them into some sort of log file. Any issues, you can read Paypals feedback and IPN data/delivery information here https://www.sandbox.paypal.com/uk/cgi-bin/webscr?cmd=_display-ipns-history&nav=0.3.4 [Found from History->ipnHistory on the Paypal menu] and it should list them out. You can resend any failed or queued or undelivered messages.
Paypal is a terribly documented and terribly structured system for coding with. I hate it. Use Stripe.
I love bullet points.
Paypal claims they will try and resend failed/queued IPNs 16 times over 5 days. I have yet to see this, you need to resend them manually (at least, sandbox ones)
Please remember all the settings and changes you have made to your Sandbox account will need to be also made to your live account before you make your payment system live!
Solution
My return_URL is the location of my IPN.php file which take care of the data sent and received. My problem is that the IPN is only firing when I click the "Return to merchant website" and not when the payment is actually completed
What you have done, from reading your comments, is set your IPN page to being your return from paypal page, this is NOT the way IPN is supposed to work, the IPN page should never be visited by the customer, only ever by Paypal.
Read through my anwser (points 2,3,4) and set up your IPN web link as I have described above, your return_url value should be a basic page to say to the customer "transaction complete". The IPN page is defined on your paypal accounts (sandbox and live) as I stated above.
This will fix your problem.

Paypal IPN getting delayed by hours

I'm using paypal adaptive payments to make transaction via paypal. Although few of transactions are taking more than 6 hours too receive IPN.
I've gone through forum posts and their documentation, I came through - https://developer.paypal.com/webapps/developer/docs/classic/products/instant-payment-notification/
"Because IPN is not a real-time service, your checkout flow should not wait for the IPN message before it is allowed to complete. If the checkout flow is dependent on receiving an IPN message, processing can be delayed by system load or other reasons. You should configure your checkout flow to handle a possible delay."
The callback is taking more than 6 hours is way too much. any suggestions ?
I've built several custom carts. On average, I see the PayPal IPN come back within 2 minutes at the longest, and usually recurring payments take longer than single payments because they send two IPN messages, not just one, on the initial setup. I usually take the 'custom' property and put a unique identifier that I have permanently cookied. So, even though I may see an initial IPN come in on a recurring payment, I wait for the one that says that txn_type is subscr_payment and also that payment_status is Completed. You can't really trust a subscription payment as being paid unless you see that second message. And if it's a single payment, then I look for txn_type to be web_accept and payment_status to Completed.
The way I handle things is to redirect the customer to PayPal to purchase using the form button technique. The customer pays and then gets redirected (thanks to the form hidden vars I created initially) back to my own custom cart URL that I specify. I call that URL the payment-confirmation script. I display a message with a progress bar to please wait while their payment is being confirmed with PayPal. I hold them there 10 seconds and then redirect to the receipt. It is on the receipt where I check the database to see if my IPN script has already processed this order. If not, then I redirect them back to the payment-confirmation script again for another 10 second progress bar delay. My receipt uses a session cookie to ensure I never send them into a loop more than one time to the payment-confirmation script. So, the customer waits another 10 seconds and then comes back to the receipt page, where I test again, reading my permanent cookie on the 'custom' property that I saved, versus the 'custom' property that comes in from the IPN that I use as the order key in the database. Usually within the first or second 10 second delay, the IPN has come in and I can proceed. However, if the IPN has still not come in, then I redirect to a friendly error message saying that their payment cannot be confirmed and to call our call center to remedy the issue. Our call center techs then see the delay problem in PayPal, back the other transaction out, and sell to the customer over the phone manually, instead.

Will paypal still accept the payments and redirects to suceess page? IPN

My question is very simple and no related to any kind of troubleshooting its just to get the information about the IPN
Lets say:
I have a system Paypal integrated activated IPN and working fine
someone tried to Price Jack a product and changed the price from 200$ to 2$
My IPN detected that and informed me about that issue (through mail as i set in my IPN).
My question is will paypal still process that payment and accept that 2$ and redirect user to my success page? or it will stop the processing the payment?
Ofcourse I have the proper handling of that and will not update the database
but question is will those 2 dollar will get processed in my paypal?
if yes is there any way to stop paypal from processing?
Note that there're multiple ways to protect your payment button code (price and other details) and also a very rare chance that an HTTPS payment request got "price-jacked" by a man-in-the-middle attack or malicious fraud activity, but still a valid question to be clarified.
In this case, the $2 will be processed just as a normal transaction to PayPal, and the asynchronous IPN will only be triggered by the event of payment completion. That's when your website backend will reconciliate and detect the "price-jack" by IPN callbacks, after the payment processing but not before.
Eventually, the transaction (of $2) that has taken place would be in sccope of fraud activity & dispute issue, and to be reported and handled by PayPal customer service

Is there a PayPal IPN when a suspended subscription is reactivated?

When a paypal recurring payment is suspend an IPN with either one of the following txn_type will be sent
recurring_payment_suspended
recurring_payment_suspended_due_to_max_failed_payment
Question: Is there an IPN to notify of a re-activation, like:
recurring_payment_reactivated
I could not find any info on SO, Google and https://www.x.com/developers/paypal/documentation-tools/ipn/integration-guide/IPNandPDTVariables
Or does anyone know why PayPal would provide an IPN to tell us when a recurring payment is suspended
but not when its re-activated.
I just tested this scenario on the sandbox. I created a new profile using CreateRecurringPaymentsProfile and I immediately got the recurring_payment_profile_created IPN as expected.
I then suspended the profile using ManageRecurringPaymentsProfileStatus and immediately got the recurring_payment_suspended IPN as expected.
I then reactivated the profile using ManageRecurringPaymentsProfileStatus, but I did NOT get any new IPN from this action.
Based on those findings I would say, no, you will not get one in production either.
That said, I always recommend using the GetRecurringPaymentsProfileDetails API to check the current status of a profile any time users log in to a paid area of your site (or attempt to access anything that requires a valid profile.)