• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

117
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 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error