Making a Parallel request with request npm package.

AxY-
Contributor
Contributor

I'm trying to make parallel request through request-npm package but seems like way i construct the data is wrong.

 
request.post(`https://api-3t.sandbox.paypal.com/nvp`).form({
				USER: user,
				PWD: PWD,
				SIGNATURE: "signature",
				METHOD: 'SetExpressCheckout',
				PAYMENTREQUEST_0_CURRENCYCODE: "USD",
				PAYMENTREQUEST_0_AMT: "1",
				PAYMENTREQUEST_0_ITEMAMT: "1",
				PAYMENTREQUEST_0_TAXAMT: "1",
				PAYMENTREQUEST_0_PAYMENTACTION: "Sale",
				PAYMENTREQUEST_0_DESC: "Your Item",
				PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID: mail,
				PAYMENTREQUEST_0_PAYMENTREQUESTID: "charity",
				L_PAYMENTREQUEST_0_NAME0: "charityDonation",
				L_PAYMENTREQUEST_0_NUMBER0: "SS-101",
				L_PAYMENTREQUEST_0_QTY0: "1",
				L_PAYMENTREQUEST_0_AMT0: "1",
				L_PAYMENTREQUEST_0_TAXAMT0: "1",
				L_PAYMENTREQUEST_0_NAME1: "CharityDonation",
				L_PAYMENTREQUEST_0_QTY1: "1",
				L_PAYMENTREQUEST_0_AMT1: "1",
				L_PAYMENTREQUEST_0_TAXAMT1: "1",
				PAYMENTREQUEST_1_CURRENCYCODE: "USD",
				PAYMENTREQUEST_1_AMT: "1",
				PAYMENTREQUEST_1_ITEMAMT: "1",
				PAYMENTREQUEST_1_TAXAMT: "1",
				PAYMENTREQUEST_1_PAYMENTACTION: "Sale",
				PAYMENTREQUEST_1_DESC: "MocktailLarge",
				PAYMENTREQUEST_1_SELLERPAYPALACCOUNTID: mail,
				PAYMENTREQUEST_1_PAYMENTREQUESTID: "CART2",
				L_PAYMENTREQUEST_1_NAME0: "Orangecrush",
				L_PAYMENTREQUEST_1_NUMBER0: "MC-77",
				L_PAYMENTREQUEST_1_QTY0: "1",
				L_PAYMENTREQUEST_1_AMT0: "65",
				L_PAYMENTREQUEST_1_TAXAMT0: "10",

			}), (err, response) => {
				if (err) {
					console.error(err);
					return res.sendStatus(500);
				}

				console.log('We got IT!', response)
				return res.status(200).json({
					error: false,
					id: response.body.id,
					code: 200
				})
			};
 
Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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