Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
PayPal JS SDK server integration - including additional parameters

I wanted to integrate the new JS button. I'm on this page trying to figure out how to do this. I understand how it's supposed to work, but I don't get how to call a server script to handle the database updates.

It seems this line:

return fetch('/demo/checkout/api/paypal/order/' + data.orderID + '/capture/', {method: 'post'}

is calling a script, but how can I include arguments?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In the line you quote, the content of data.orderID becomes a path (URL) argument, and that URL is fetched. This URL needs to be a route on your server.

If you want to pass additional arguments, or put the order ID in the body of the request instead of the URL, you can do so. Use body in the options to fetch, and give it a JSON object/string. Something like:

return fetch('/path/on/your/server/to/capture/order', {
  method: 'POST',
  body: {
    id: data.orderID,
    your_argument_name: 'some data';
  }
});

On the server end handling the route, you'll need to deserialize that JSON object. Plenty of guides out there on how to read JSON input for whatever backend environment you're using (notably you do not use PHP's $_POST as that is for form encoded data only)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!