Last updated

These docs are intended for a developer audience.

Set up Apple Pay

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

If you want to use Apple Pay inside an iOS application, contact us.

1. Obtain IDs and a publishable API key

When you first log in to Rebilly, you create an organization as part of the setup process. A default website is created when a new organization is created. For more information, see Organizations and websites.

  1. Log in or sign up to Rebilly.
  2. Obtain your organization ID and website ID:
    1. In the left navigation bar, click Settings .
    2. In the Management section, click My organization & websites.
    3. In the Organization details section, note the ID value.
    4. In the Website section, note the ID value.
  3. Obtain your publishable API key:
    1. In the left navigation bar, click Automations .
    2. In the Development section, click API keys.
    3. Optionally, if you have not created a publishable key:
      1. In top right of the screen, click Add API.
      2. In the API key type section, select Publishable, then complete the form and click Save API key.
      3. Go back to the API Keys page.
    4. Select a publishable key and copy the Key value.

2. Set up Apple Pay

This step describes how to use FramePay to tokenize payments made using Apple Pay.


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.


Include the FramePay script

This exposes FramePay in the global JS scope as Framepay.


Include the HTML mounting points

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

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


Configure FramePay

This step describes the basic set up for mounting.


Initialize FramePay with a configuration object.

FramePay configuration reference


Rebilly data

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


Transaction data

Provide the transaction data. Apple Pay requires amount, currency, and label.


Get the payment token

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

  • To pass Apple Pay authentication parameters, the initial transaction must be completed using the payment token, and not using a payment instrument.

  • After completing a transaction using the token, the payment instrument will be returned and can be re-used.

  • Apple Pay authentication parameters are not persisted to the payment instrument but the gateway will have reference of this initial customer-facing transaction.

  • Creating a payment instrument from the token and using that will only include the basic card data (device PAN, expiry).

For more information, see Payment instruction.

Mount the Apple Pay button

After initialization, mount the Apple Pay button in the container element.

Framepay.on('ready', ...)



Listen for the generated payment token

When a customer completes the Apple Pay flow, Rebilly creates a payment token.

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

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


Basic set up complete

To learn more about Apple Pay and FramePay, see: - Apple Pay domain registration - Apple Pay testing - Configuration reference

Copy to clipboard
  • HTML
  • JavaScript
1<!doctype HTML>
3 <head>
4 <link href="" rel="stylesheet">
5 <script src=""></script>
6 </head>
7 <body>
8 <form>
9 <div id="apple-pay-mount"></div>
10 </form>
11 </body>

Interactive example