Receive Dynamic Payments via PayPal
ATTENTION: THIS IS OUR OLD SITE. TO SEE OUR NEW WEBSITE, CLICK HERE.
Learn how to integrate custom payment values via PayPal using HTML iFrame and test whether a successful payment has been made. This is the PayPal payment functionality used throughout WixCodeBank.com to unlock pages of code.
The first step is to create an account with PayPal. Thereafter, add an HTML iFrame to a page on your website. Give it an id reference, such as HTMLPayPal and add an onMessage event listener as shown in the screenshot below. The HTML iFrame is set to hide onReady in this example using $w("#htmlPayPal").hide(); .
Insert the code below into the HTML iFrame - it creates a PayPal container which will receive the payment amount via code from your website. The sandbox and production keys are provided by PayPal after you create an App following the steps given here:
The line of code starting with 'env:' toggles between sandbox (for testing) and production (for taking actual payments). If the payment is successful, the PayPal container will send back a message of "1" to the page code - which will be used to verify and record the payment in the Customer collection data.
