Set up PayPal

This topic describes how to add FramePay to a checkout form and use it to accept PayPal payments.

1.Include FramePay

To enable FramePay, include the following line in your checkout page. This exposes the library in the global JS scope as Rebilly.

Copy
Copied
<script src="https://framepay.rebilly.com/rebilly.js"></script>
Automatic updates

Backward-compatible updates will be made available automatically without the need to change this URL.

2. Initialize FramePay

In an earlier step, you included the rebilly.js script in your checkout page. In this step you will access the globally exposed Rebilly object to initialize it.

  1. If you do not have a sandbox API key, create one.
  2. Include the following line in the JS of your checkout page, and replace the publishableKey value with your API key:
Copy
Copied
Rebilly.initialize({
        // Use your own publishable key:
        publishableKey: 'pk_sandbox_Lvl5rm8lLrtAV6iSL3CIdYLAburumF4Ld8b1KDs',
});

You must replace the key pk_sandbox_Lvl5rm8lLrtAV6iSL3CIdYLAburumF4Ld8b1KDs with your own. We recommend starting with a sandbox key. To create a publishable key, check API keys section.

3. Create payment token

PayPal does not require mounting elements in your checkout form.

Copy
Copied
const extraData = {
    method: 'paypal'
};
// Inspect result content to check the shape of the created payment token
const result = await Rebilly.createToken(form, extraData);