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

145
Views
PayPal button does not capture and onApprove does not return capture function

Everything was working fine but suddenly without changing any code, I noticed that approved orders do not get captured automatically and I have to capture the payment manually using curl.

After some investigations... I found out while using sandbox everything works as intended, I compared the response of live and sandbox modes and I found out that onApprove() actions parameter response in live mode is

{
  order: {},
  payment: null
}

While in sandbox mode is

{
  order: {capture: ƒ, authorize: ƒ, patch: ƒ, get: ƒ}
  payment: null
  redirect: ƒ r()
  restart: ƒ r()
}

So, actions.order.capture() does not exist in live mode, hence does not capture automatically and no onError exceptions were thrown.

My onApprove code

onApprove: function(data, actions) {
  return actions.order.capture().then(function(details) {
    alert('Transaction approved by ' + details.payer.name.given_name);
  });
},

How can I resolve this problem?

about 4 years ago · Juan Pablo Isaza
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!