javascriptpaypalpayment-gatewaypayment-processingpaypal-buttons

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?


Solution

  • 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.