Set up Samsung Pay

This guide describes how to use the FramePay library to tokenize payment card data from Samsung Pay.

Prerequisites

To complete this guide, you must register a domain, which is a manual process. Contact us for help with this process.

You must also have an organization ID, a website ID, a publishable API key, and a payment gateway configured in your Rebilly account. For sandbox testing, the TestProcessor gateway is pre-configured.

If you already have your IDs and API key, continue to Step 1: Initial setup. If you do not, see Set up your environment.

Samsung Pay has limited support for devices and browsers. For more information, see the Samsung Pay Web Payments Integration Guide prerequisites.

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

  • After completing a transaction using the token, the payment instrument is returned and can be reused.

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

  • Creating a payment instrument from the token only includes the basic card data (device PAN, expiry).

For more information, see Payment instruction.

Step 1: Initial setup

Set up the FramePay library and create the necessary HTML structure.

Include the FramePay stylesheet

Add the default styles for the FramePay library elements on the page.

Include the FramePay script

Expose the FramePay library in the global JS scope as Framepay.

Include the HTML mounting points

Specify an empty HTML element where the FramePay library will mount the Samsung Pay button.

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

Step 2: Configure FramePay

This step covers the basic configuration needed to mount the Samsung Pay button.

Initialize

Create a configuration object and initialize the FramePay library with it.

FramePay configuration reference

Rebilly data

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

For more information, see Prerequisites.

Transaction data

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

Step 3: Get the payment token

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

Mount the Samsung Pay button

Mount the Samsung Pay button in the container element.

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

Framepay.samsungPay.mount(...)

Listen for the generated payment token

When a customer completes the Samsung Pay flow, Rebilly creates a payment token. Listen for the token-ready event to retrieve it.

At this point, you can use the token for other operations, such as creating a payment instrument or transaction.

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

Preview

To interact with this example, you must open this webpage in a Samsung mobile device.

Complete the payment flow using this test card number: 4111 1111 1111 1111. Use any future expiration date and any 3 digits for the CVC number. For more test cards, see Test payment cards, IBANs, and ACH details.

<!doctype html>
<html>
    <head>
        <link href="https://framepay.rebilly.com/framepay.css" rel="stylesheet" />
        <script src="https://framepay.rebilly.com/framepay.js"></script>
        <script src="./client.js" defer></script>
    </head>
    <body>
        <form>
            <div id="samsung-pay-mount"></div>
        </form>
    </body>
</html>