Receive Dynamic Payments via PayPal


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 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.
Please login or sign-up (it's free!) to view our code. Refresh the page if already logged in.
Disclaimer: To the best of our knowledge, this code works for its stipulated purpose. If you find an error in our code, or know of a better way to achieve the same result - please contact us! We will help where we can, however please be aware that the code is provided 'as is' and without a promise of support in using or implementing it.
  • Facebook Social Icon
© VeloCodeBank