Search code examples
node.jspaypalpaypal-rest-sdk

How to make Paypal button for accepting payments with Node SDK?


Creating a buy now button with the button builder on the paypal website only allows you to create a button that will send the user to the paypal website for checking out with paypal.

I'm using the nodejs SDK to directly accept credit cards and prevent the user from having to leave my website in order to complete the payment. My question is how can I create a paypal button that calls the appropriate function in my application when the button is clicked instead of taking the user to a paypal payment page?

I'm assuming that when the payment button is clicked it ought to trigger a function in my application that creates the payment using the nodejs paypal rest-SDK module instead of sending the user to the paypal website.

The problem is that I could create any old button, but to comply with paypal's developer agreement it seems you have to use their buttons. The only solution I've thought of is to download one of their button image files from their website. This image could then be used to make a button that calls the appropriate function. Would this be okay?


Solution

  • For Direct Credit Card integrations, you do not have to use a PayPal button as your customers do not even need to know PayPal is involved. Typically, you would build a form to collect the customer and credit card data then post that to a script on the back end to map those variables to the correct SDK fields and submit the payment.