Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda