Set up Google Pay™
This topic describes how to use FramePay to tokenize payments made using Google Pay™.
1. Obtain IDs and a publishable API key
- Obtain your organization ID and website ID:
- In the left navigation bar, click
.
- Click My organization & websites.
- In the Organization info section, note the ID value.
- In the Website section, note the ID value. If you have not created a website yet, see Add new or additional websites. An organization is created automatically when you sign up to Rebilly.
- In the left navigation bar, click
- Obtain your publishable API key:
- In the left navigation bar, click
Automations, then click API keys.
- In the API keys page, note the Secret key value. If you have not yet created an API key, click Add API key, complete the form, make sure you select Publishable in the API Key Type and note the Secret key value.
- In top right of the screen, click Add API key.
- Optionally, if you have not created a publishable key:
- In top right of the screen, click Add API.
- In the API Key Type section, select Publishable, then complete the form and click Save API key.
- Go back to the API Keys page.
- Select a publishable key and copy the Key value.
- In the left navigation bar, click
2. Set up Google Pay™
This step describes how to use FramePay to tokenize payments made using Google 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 Rebilly
.
Include the HTML mounting points
You must specify an empty HTML element where FramePay renders the Google 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
Initialize FramePay with a configuration object.
Rebilly data
Transaction data
Provide the transaction data. Google Pay™ requires amount, currency, and label.
(Optional) Customize Google Pay™
Optionally, to control the look and feel of the Google Pay™ button,
Get the payment token
Mount FramePay onto your page and listen for a payment token.
Mount the Google Pay™ button
After initialization, mount the Google Pay™ button in the container element.
Listen for the generated payment token
When a customer completes the Google Pay™ flow, Rebilly creates a payment token.
To retrieve it, listen for the token-ready
event.
Basic set up complete
To learn more about Google Pay™ and FramePay, see:
- JavaScript
- HTML
1Rebilly.initialize({2 publishableKey: 'pk_sandbox_123',3 organizationId: 'org-123',4 websiteId: 'website-123',5 transactionData: {6 currency: 'USD',7 amount: 10,8 label: 'Demo purchase label'9 },10 googlePay: {11 buttonColor: 'black',12 buttonType: 'buy',13 buttonHeight: '48px',14 },15});16Rebilly.on('ready', function () {17 const googlePay = Rebilly.googlePay.mount('#google-pay-mount');18});19Rebilly.on('token-ready', (data) => {20 // At this point you can use the token for other operations21 // for example to create a payment instrument or transaction22 console.log('Payment token:', data);23});
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="google-pay-mount"></div>10 </form>11 </body>12</HTML>
Interactive example
This is an interactive example of a basic checkout form which uses FramePay to tokenize payments that are made using Google Pay™.
It showcases all possible Google Pay™ button styles.