Can't manage to verify a Paypal payment


Dear All,

I am trying to implement a paypal payment system through their API. Do not ask why I don’t use braintree or stripe… it’s a client specification for some reasons that it goes through plain paypal and now I am struggling to implement the payment verification.

I implemented the paypal payment form with the sandbox that works. I mentioned a notify-url to get feedback and it is then that I have to do the paypal verification (to make sure the payment information I received is real) according to this documentation : and this

My code is as follow :

import { Meteor } from 'meteor/meteor';

import moment from 'moment';
import bodyParser from 'body-parser';

import { HTTP } from 'meteor/http'

Picker.middleware(bodyParser.urlencoded({ extended : false }));
// Picker.middleware(bodyParser.json());

let postRoutes = Picker.filter(function(req, res) {
	return req.method === "POST"

postRoutes.route('/payment_received', function(params, request, response, next){
	response.statusCode = 200;

  let convertAsyncToSync = Meteor.wrapAsync(;
	let test = JSON.stringify(request.body);

 	let body2 = 'cmd=_notify-validate&' + test.slice(1, -1).replace(/"/g,'').replace(/:/g,"=").replace(/,/g,'&')
  let result2 = convertAsyncToSync('POST', "", {
  	headers: {
    	'Connection': 'close'
    body: body2


According to the doc I though I should get a “VERIFIED” or “INVALID” response, instead of this I get a full HTML page which I have no idea why.

Even if I test the post request with a simple REST client I do not get the good reply. No idea why and I am stuck there. Anyone with paypal experience ?


Have you looked at the actual contents of the HTML page you’re getting? What does that one say?

Because my first instinct when I get a full-body HTML response instead of simple text:

“I probably have the wrong URI or the wrong connection method (e.g. GET instead of POST)!”


You could use planefy:paypal-ipn-listener or look at the source code to see how it’s done (note: package author)