Today we will learn more about Wix PayPal integration in this blog. Integrating PayPal using their REST API can be a tricky task but we are going to over the steps you need to take as a Velo developer to allow someone to initiate a payment from their Wix website and complete the payment on PayPal’s Checkout page.
First setup a page which contains an item name and an amount in 2 text elements. The first major chunk of code you need to write will be on your backend file called payPal.jsw
PayPal Backend File
Next create a .js file on your backend called http-functions.js
Backend HTTP Functions File
On your page make sure you have the property id of the item text as #itemName & the price as #price after which create an onClick event handler and copy the below code below.
Page Code For UI
To get the an access token you need to provide an encoded version of the PayPal Client ID & Secret Key. To retrieve both go to developer.paypal.com and login with an existing PayPal account. After that create a new app by clicking on the ‘Create App’ button. Copy the Client ID & Secret Key given and encode it together (your choice) before inserting it in the API call.
You will also need to create a webhook to allow PayPal to communicate the status of the transaction to your website. To learn more about exposing your site’s API and receive incoming requests go through the Wix HTTP Functions area of the Velo API Documentation.
View PayPal Help Documents: