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

183
Visualizações
Capture payment method used to pay with PayPal Checkout/Orders API

I'm using the Standard Integration of PayPal Checkout (via the Orders API), and want to capture the actual payment method - which I believe PayPal calls a "funding source" - that the customer paid with, so that I can pass this value to my server and persist it to my database.

What API object do I need to call to get this information?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

When using JS SDK buttons that call your server, you can track which button on your site was clicked by passing an onClick function; its first parameter will be an object with fundingSource set to e.g. "paypal", "venmo", "card", "paylater". Have it store this to a global or w/e and then you can include this in the JSON body sent to your server when capturing an order from onApprove.

However, the actual funding method that the payer ended up using might not correspond to that initial click selection, and is not returned; this and all other billing information is kept private to the payer in PayPal by design.

about 4 years ago · Juan Pablo Isaza Relatório

0

This is a similar approach to the one that Preston outlines, and in the same way it has the limitation that it only returns the funding source of the button that's initially selected rather than the one that the user actually paid with (as this can be changed by the user from within the PayPal modal).

It seems that this is currently the closest that those using the Standard integration of PayPal Checkout can get to obtaining the payment method the user actually paid with because, for some reason, PayPal only sees it necessary to expose that information (which does exist in the API) to developers who have implemented the Advanced integration.

This is a disappointment if you're someone like me who's invested considerable time in integrating the Standard integration only to find out too late (thanks to poor documentation of both the integrations and the API) that the Standard integration can only access a crippled version of the API that has limited data.


In your client-side JavaScript, add fundingSource: fundingSource and any other variables you want to grab from the order data:

paypal.Buttons({

...

onApprove: function (data, actions) {
    return fetch("/route/to/paypal/capture", {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
        },
        body: JSON.stringify({
            fundingSource: fundingSource, 
            // Add any other variables you need here
        }),
    })

...

Then, when capturing the payment on your server, use:

$data = json_decode($request->getContent(), true);
...
$payment_method = $data["fundingSource"];
about 4 years ago · Juan Pablo Isaza Relatório
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