Set up PayPal

This topic describes how to use FramePay to tokenize payments made using PayPal.

1

Initial set up

Set up the library and provide the HTML.

Include the FramePay stylesheet

This adds default styles to FramePay elements on the page.

HTML

Include the FramePay script

This exposes FramePay in the global JS scope as Rebilly.

HTML

Include the HTML mounting points

You must specify an empty HTML element where FramePay renders the PayPal button.

Edit your checkout form to add new HTML element with a unique ID.

HTML
2

Configure FramePay

This step describes the basic set up for mounting.

Initialize

Initialize FramePay with a configuration object.

FramePay configuration reference

JavaScript

Rebilly data

Provide your publishable API key, organization ID and website ID to connect with the Rebilly API.
JavaScript

Transaction data

Provide the transaction data. PayPal requires amount and currency.

JavaScript
3

Get the payment token

Mount FramePay onto your page and listen for a payment token.

Mount the PayPal button

After initialization, mount the PayPal button in the container element.

Rebilly.on('ready', ...)

Rebilly.paypal.mount(...)

JavaScript

Listen for the generated payment token

When a customer submits the PayPal form, Rebilly creates a payment token.

To retrieve it, listen for the token-ready event.

Rebilly.on('token-ready', ...)

JavaScript

Basic set up complete

To learn more about PayPal and FramePay, see:

Copy to clipboard
  • JavaScript
  • HTML
1<!doctype HTML>
2<HTML>
3 <head>
4 <link href="https://framepay.rebilly.com/rebilly.css" rel="stylesheet">
5 <script src="https://framepay.rebilly.com/rebilly.js"></script>
6 </head>
7 <body>
8 <form>
9 <div id="paypal-mount"></div>
10 </form>
11 </body>
12</HTML>

Interactive example