IPN Response Message is sent by paypal, received by my server, but the body is empty?

AdrianTrm
Contributor
Contributor

Hello there, basically we have a suscribe button and we have an IPN listener on the server, we receive the IPN listener just fine, but when we try to get the body to verify it, it comes up completely empty, although in the IPN history, it comes with all the correct information.

 

We're using a node server with body-parser and express

 

Here's the code.

app.post('/ipn', function (params, response) {
	response.sendStatus(200);
	console.log('accedio al ipn');
	console.log(params.body);
});

We send back the 200 status as states on the docs, then the request body is completely empty.

 

Thanks in advance!

 

Login to Me Too
3 REPLIES 3

angelleye
Advisor
Advisor

I wouldn't send your own 200 response.  That will happen automatically by the server if everything runs correctly.  If not it would return a 500 and then IPN would know it needs re-try sending the data until it does get a 200 response.  If you were going to send your own status you'd want to do it at the end of your script after everything has run.  

 

I'm not very familiar with node, but it looks like you're basically calling an API via app.post() and pointing it to your IPN URL..??  You would need to first use PHP or something to process the data and save it to your own database.  Then you could build your little web service to pull that data via node call from your own database.

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Login to Me Too

AdrianTrm
Contributor
Contributor

I removed the 200 status code but it still sends an empty body.

 

Supposedly I should be able to get the body without involving any database, or that's what I thought atleast... I need to get who made the payment so I can update ther state on the database.

Login to Me Too

angelleye
Advisor
Advisor

The data is available in $_POST without saving to the database, but of course that's PHP I'm referring to.  I'm assuming there is something similar with Node.

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.