Pay Pal webhooks never called - paypal

I have been using Pay Pal for payments from our website for many years without problems.
We currently use Pay Pal buttons to redirect to Pay Pal's website for the payment, and have it return to our website to record the payment.
Now we are trying to configure webhooks in Pay Pal to have it notify our server of payments. The goal is to have auto renewing subscriptions that call the webhook every month when Pay Pal automatically processes the payment.
So I setup the webhooks on,
https://developer.paypal.com/
I setup the webhooks for both the sandbox and live account, and verified it can call the webhook successfully through their webhook simulator.
However, when any payment is made through our website the webhooks are never called?
I've tried everything, but they are never called.
Are the webhooks only called if you make the payment through the Pay Pal API, or are they also called if a payment is made directly, or through a Pay Pal button?
Do they get called for auto-renewing subscriptions?

Okay, so now I know that said you did set up the webhooks. However, I am still going to include doing that in my answer anyway.
Step 1: Creating The PayPal Application
Visit URL: https://developer.paypal.com/developer/applications/ and
click 'create app'
Give your Application some name and move forward.
Step 2: Adding/Managing WebHooks For Your Application
After creating the app, you will be presented with this screen.
Scroll a bit down and click 'Add Webhook'.
Add your desired webhooks (subscription webhooks are here). If you are not sure. Just choose 'All events' (the first option) for the time being. Also, make sure you add a Webhook URL.
Step 3: Listening for WebHooks
Webhook Details:
https://developer.paypal.com/docs/api-basics/notifications/webhooks/event-names/#sales
The webhook you need to listen for auto-renewing subscriptions is: PAYMENT.SALE.COMPLETED
Step 4: Verifying you are getting the Callbacks
You can visit:
https://developer.paypal.com/developer/dashboard/webhooks/live to see
all the webhooks that were fired by PayPal (only stores up to 30 days).
Personally, I would try to log everything that I receive at my
endpoint and compare my log with PayPal's log.
Step 4: Validating the Callbacks
Furthermore, you can also visit:
https://developer.paypal.com/docs/api-basics/notifications/webhooks/rest/#to-use-the-paypal-rest-sdks-to-verify-event-notifications
to get the sample code(s) to validate the callback (webhooks) once you receive
them.

Please understand the distinction as i have quoted from the below sources.
The PayPal REST APIs use webhooks for event notification.
.
.
The Paypal BuyButton triggers IPN

Related

PayPal webhook did not receive any events

I created a PayPal plus Payment in my website. I can choose a payment methode and I can pay.
I have also created a PayPal webhook. The webhook works. I tested it in the webhook simulator.
The problem is: if I pay i receive nothing in my webhook.
What can I do?
Presumably you need to Subscribe to Events by providing your webhook URLs PayPal; note that this is completely separate from testing in the simulator. See: https://developer.paypal.com/docs/integration/direct/webhooks/rest-webhooks/#subscribe-to-events

Paypal doesn't fire webhook on BILLING.SUBSCRIPTION.CANCELLED in sandbox

I haven't tested in live, but currently I have a webhook subscribed to the following events
Billing subscription cancelled
Billing subscription created
Billing subscription re-activated
Billing subscription suspended
Billing subscription updated
I'm receiving Webhook events for CREATED but nothing is being sent when a user cancels the subscription from their PayPal dashboard.
Is this expected behavior? is there another event I should be subscribe to to capture that user action?
Is there a debug id that you can share so we can trouble shoot?
Thanks,
Usha
From Paypal support (I still don't understand why the BILLING.SUBSCRIPTION.CANCELLED doesn't fire when a user cancels from their dashboard, similar issue here: BILLING.SUBSCRIPTION.CANCELLED does not fire upon user action?)
"But surely users subscribing via the button is the most common method of subscribing (how else would they subscribe?). The IPN route seems like a completely non-developer-friendly one (seeing as there isn't even simulator events for it)"
If you integrate a solution which is not based on our REST API's and want to receive HTTP notifications, you need to use instant payment notification (IPN). The IPN simulator may not provide a method of simulating the events, but you can create subscriptions in our sandbox environment and setup a sandbox business account with IPN and test cancelling the subscriptions, which will generate an IPN for the cancellation. We have a sandbox testing guide available here if you're not familiar with that environment and want to get started.
"So why would webhooks ONLY fire for API-based subscriptions (and why would a business website subscribe users using the API rather than the simple button)? What is the logic behind this?"
It depends on the integration and needs of the individual business. Some businesses only use our REST-based API solutions for their complete integration, from checkout payments to subscriptions and logically, this makes sense to them to only have to use one set of API's for their complete integration. Other business only want / need a more simple solution such as using buttons and as these are legacy solutions which are not REST-based, they use our legacy HTTP notification service which is instant payment notification (IPN).

PayPal Subscription Cancellation from Merchant Website

we have a paypal payment system integrated into our website so people can register and choose a subscription. The subscription part works fine as the payment goes through and the IPN hits our website and updates our systems. Now we want users to be able to cancel their subscription from within our website so we have a custom cancellation button which when clients click, should send a request to paypal and cancel their subscription. We managed to get this going on sandbox test system however since we have brought the system into live testing we can not get the cancellation feature to work. So currently when the user clicks on cancel button, i think paypal is not being notified and hence no IPN received from PayPal.
Do you know what all info we need in order to cancel the subscription from our website. I know there is a way where users can log into paypal and cancel their subscription or we can log into our paypal and cancel their subscription but we want it to work from our website.
Please help!
Thanks.
When you say you have it working on the sandbox but not live, what exactly is going wrong when you try it live?
I'm actually a little confused by that, because my initial answer was going to be that you can't kill subscriptions via the API unless you're using Recurring Payments. Standard subscriptions aren't accessible via the API.
If you're saying you're doing that in the sandbox, though, then there must be something I'm unaware of..??
On that note, I know the PayPal system pretty well, so I'm thinking maybe you did Recurring Payments on the sandbox, but live you're using Standard Subscriptions..?? If that's accurate then you'll need to move to recurring payments instead of standard subscriptions on the live site.

How can I cancel a paypal recurring payment from my website?

I'm currently integrating the paypal recurring payment process in my website (thanks to https://www.paypal.com/uk/cgi-bin/webscr?cmd=_pdn_subscr_techview_outside) and, for the moment, it works.
But I have a simple question, and I don't find the answer on Internet. Let's say a user deletes his account on my website after 2 months. How can I cancel automatically his subscription ?
Thank you!
It takes a bit of effort to find, but Paypal does publish a guide on subscriptions.
To cancel someone's subscription, you need to create a link to Paypal -- see page 171 of that reference. There doesn't appear to be an API which allows you to cancel their subscription for them: they need to click a link to Paypal and cancel the subscription themselves.
The guide actually says
Paste the code onto you webpage [sic] near text that explains how subscription cancellations work.
Apparently it's possible to cancel recurring payments with the API. See:
Can you cancel a PayPal automatic payment via API? (Subscription created via Hosted button)
This is certainly more complex than the "unsubscribe" button that paypal gives you, but... it could actually work. The "unsubscribe" button requires that people's payments are coming from their PayPal account, which is not the case if they set up recurring payments on a credit card (without logging into PayPal.)

Checking if paypal payment was successful

I have downloaded sample code from paypal to allow me to use parallel payments via their sandbox accounts. When I run parallel.php, I get redirected to paypal's sandbox login page.
How am I supposed to know "server side" that the payment has been made successfully, so I can update my database records?
I believe you have to work with PayPals IPN system. This will basically send a confirmation to your server that tells you it has gone through.
https://www.paypal.com/ipn
Paypal lets you register a notification url which is part of the IPN (instant payment notification IIRC) system. So if someone pays by a delayed payment (such as a bank transfer) the transaction will update days later. You need to have an application (web page) on your server that can be called by Paypal with transaction details to update a payment.
You'll need to create an initial transaction record in your system when paypal redirects back to you so refer to their documentation for that. I'd also recommend looking at either OSCommerce or Zen cart for an idea of how they do it as they support the same kind of thing.