PayPal REST Webhooks sending no data - paypal

I'm trying a simple enough task, just to get PayPal's webhook to send data. So I'm sending various events through from developer.paypal.com's webhook simulator, which is successfully contacting the server, but which is sending blank data. The code to check what data is sent is
$mysqli->query("INSERT INTO paypal_webhook_tests (`datetime`,`data`) VALUES ('$datetime','SOMETHING PASSING THROUGH')");
foreach ($_POST as $key=>$val){
$store = $key.$val;
$mysqli->query("INSERT INTO paypal_webhook_tests (`datetime`,`data`) VALUES ('$datetime','$store')");
}
What ends up happening is that there is nothing in POST at all. What's going on with this?

You could potentially use https://requestb.in/ for creating a request inspector, that could be used as a URL for webhook simulator. This will allow you to make sure you are getting the expected data. Once you are able to confirm that, you should be able to figure out why data is not seen in your webhook URL.

Related

Facebook Webhook test send not working?

I am creating a Facebook Webhook. The callback link has been verified and so the connection should be okay.
When I further test the Webhook by pressing the test button under feed,
it seems it works.
However, nothing's received in my server, not even an access log in Apache. (I have checked both ssl_access_log and access_log) Any suggestion on what I have possibly missed?
Did you forget to write POST request method ?
Facebook Webhook confirm callback URL in GET request, but they send event in POST request. So you need both GET and POST method in your server.
It turns out to be the problem of using vhosts. The vhosts is set up by my colleague and he decided to save the access log and error log putting in other position than the default location.

Sending data messages without REST Api in Firebase

I was planning to send data messages (I do not mean notification messages!) to specific users via FCM. I tried the REST Api named ARC but since it is still in beta use it seems like there are still some issues that need to be fixed. I get "401 Unauthorized" all the time so I was looking for another way to get these messages to the users. How exactly am I supposed to send the requests to the Firebase-endpoint (https://fcm.googleapis.com/fcm/send)?
MY Request looks like this:
Request
Thanks alot!

Facebook Messenger Platform - Webhook Subscription

I have followed the steps to setup the Facebook Messenger platform. The verification GET web hook request work perfectly, as does the subscribe but when I submit the chat I keep getting the follow Developer Alert:
Hi Norah,
We've noticed that your Webhooks subscription for callback URL https://{domain}/v1/webhook has not been accepting updates for at least 16 minutes. Please verify that your callback server is functioning so you may continue to receive updates. If you need to update your callback URL, see https://developers.facebook.com/docs/messenger-platform/webhook-reference#webhook_setup
If your callback URL continues to fail to accept updates for 8 hours straight, we will disable your subscription. To reactivate the subscription, make a POST request with the same parameters, and it will be reactivated.
My post request works through POSTMAN.
Please can someone help me! This is driving me nuts!
Do you have logs on your server for that post requests?
Facebook requires you to return status code 200 for the post request, so they know that you successfully received it. When they havent, they try it again and if that still fails after several times, they will give you this alert.
Maybe facebook uses another content-type or message content than you used with postman.
Your server logs should give you more insights about that.
Depending on what Webhook events that you have subscribed for a page, there will be callbacks for those events, and more, on the url you have specified in the Web Hook set up.
If you had subscribed to the message_deliveries event, every time a message is sent, whether from a user to your page or from your page to a user, there is a, maybe more, calllback with a Message Delivered json object. The Webhook Reference has an example of the Message Delivered json object, but no specification or explanation on what the fields mean.
Occasionally I find that an undocumented Read callback is received, sometimes. The undocumented json data for this is like:
{"object":"page",
"entry":[
{
"id":"1722858134648129",
"time":1465407550812,
"messaging":[
{
"sender":{"id":"1131485883560113"},
"recipient":{"id":"1722858134642218"},
"timestamp":1465407550868,
"read":
{
"watermark":1465407548057,
"seq":428
}}]}]}
Essentially, you must code your callback to handle ALL types of json data gracefully, including unknowns, even though you may not be ready to process them further. For those that you are not ready to handle or uninterested in, return nothing with Http status code 204 (in fact every callback should return 204 as the type is void).
If you handle only those types of json data you are interested in, any unexpected json data will most likely raise an exception in whatever language your web callback code is written in and result in a 500 server error returned to Facebook. It is this 500 error that is causing Facebook to make that complaint in your question.

Facebook Leadgen does not send Webhook Request

I've an app which collects leads generated using Facebook Leadgen Ad.
I've a Webhook subscribed for that but for some reason it never sends any requests when leadgen form is filled.
Earlier it was working without any issues.
I noticed yesterday that I received request an hour after forms were filled whereas today I've not received any requests but I do see new leads in the CSV file I downloaded.
Will appreciate if somebody can point me to what can be going wrong here.
Thanks in advance!
Not sure if you have come across this but, there is a testing tool which you can use to submit test leads for a page and see if the lead is getting pushed to your app successfully or not -
https://developers.facebook.com/tools/lead-ads-testing?__mref=message_bubble
If you click on the Track Status button after creating test lead it tell you the status of the webhook ping for the submitted lead.

Paypal Notify_url with custom param

As all we know there is a custom param that allow us to retrieve custom data when an ipn notification come from paypal.
But also, I am using a couple of params in the notify_url, and those params sometimes get lost, and when paypal send to me the ipn notification, it comes without one of those params. The strange thing is that one of the param come correctly.
So, first question is: Can I use custom params in the notify_url like:
notify_url = "www.mydomain.com/paypal/ipn/?param1=one&param2=two"
I suppose that I can do it, because it fails 1 in 20 times on my application, so I do not know if it is because it is not supported by some browsers or something like that, or maybe it is a bad habit I should quit.
And sometimes paypal send the ipn notification to:
notify_url = "www.mydomain.com/paypal/ipn/?param1=one"
Without the second param...
And if I can do it, do you have any clue about what it is happening here...
Thanks!
I always avoid sending data to IPN as URL parameters. There are various reasons it may not come through, which means there's no guarantee it'll work correctly every single time.
Instead, use the CUSTOM parameter like you said. If you need to pass more than a single value you can send it as an NVP string just like you would on your URL. Then just parse those values back out of the CUSTOM value within your IPN script.
Alternatively, you could save all of the data you're going to need in your database and then send the record ID in the CUSTOM parameter over to PayPal. Or you could use the INVNUM parameter if that makes sense for you.
Then in your IPN script you pull that data back out of the database based on that record ID. This way you're always sure you'll have it available and won't have to worry about losing URL params along the way.