title: How to make Paypal Payouts on a Node.Js environment
body: <p>I am trying to execute a PayPal <strong>Payout</strong> on <strong>Node.Js</strong> environment, but I can't seem to wrap my head around it.</p>
  <p>Could you please help me get the parameters right, and maybe where I should re-organize the code, and eventually start heading in the right direction?</p>
  <p>Thank you all in advance.</p>
  <pre><code>var PAYPAL_API = &quot;https://api-m.sandbox.paypal.com&quot;;
  
  app.post(&quot;/my-api/execute-payment/&quot;, function (req, res) {
      // 2. Get the payment ID and the payer ID from the request body.
      var paymentID = req.body.paymentID;
      var payerID = req.body.payerID;
  
      let requestBody = {
          &quot;sender_batch_header&quot;: {
              &quot;sender_batch_id&quot;: &quot;Payouts_2018_100007&quot;,
              &quot;email_subject&quot;: &quot;You have a payout!&quot;,
              &quot;email_message&quot;: &quot;You have received a payout! Thanks for using our service!&quot;,
          },
          &quot;items&quot;: [
              {
                  &quot;recipient_type&quot;: &quot;EMAIL&quot;,
                  &quot;amount&quot;: {
                      &quot;value&quot;: &quot;9.87&quot;,
                      &quot;currency&quot;: &quot;USD&quot;,
                  },
                  &quot;note&quot;: &quot;Thanks for your patronage!&quot;,
                  &quot;sender_item_id&quot;: &quot;201403140001&quot;,
                  &quot;receiver&quot;: &quot;rev_buyer@personal.example.com&quot;,
                  &quot;alternate_notification_method&quot;: {
                      &quot;phone&quot;: {
                          &quot;country_code&quot;: &quot;91&quot;,
                          &quot;national_number&quot;: &quot;9999988888&quot;,
                      },
                  },
                  &quot;notification_language&quot;: &quot;fr-FR&quot;,
              },
              {
                  &quot;recipient_type&quot;: &quot;PAYPAL_ID&quot;,
                  &quot;amount&quot;: {
                      &quot;value&quot;: &quot;5.32&quot;,
                      &quot;currency&quot;: &quot;USD&quot;,
                  },
                  &quot;note&quot;: &quot;Thanks for your patronage!&quot;,
                  &quot;sender_item_id&quot;: &quot;201403140003&quot;,
                  &quot;receiver&quot;: &quot;xXXXXXX-50mQSYBJpg_OWguVkwYYYYYYY-ZAFupw-aaaaa-nnnnnnn&quot;,
              },
          ],
      };
  
      request.post(
          PAYPAL_API + &quot;/v1/payments/payouts&quot;,
          {
              auth: {
                  user: CLIENT,
                  pass: SECRET,
              },
              requestBody,
              json: true,
          },
          function (err, response) {
              if (err) {
                  console.error(err);
                  return res.sendStatus(500);
              }
              // 4. Return a success response to the client
              res.json({
                  status: &quot;success&quot;,
              });
          }
      );
  });
  </code></pre>