A valid OAuth token generated using the merchant application ID and the secret key asigned to the client account involved in the transaction.
clientAccount
string
Merchant account number. The value must be in the range between 900000 and 999999.
subAccount
string
Merchant subaccount number. The value must be in the range between 0 and 9999.
currency
string
Currency used for this transaction. Accepted values: USD / GBP / EUR / CAD / AUD / JPY
initialPrice
string
This is the initial transaction price. Formatted as a float value up to 2 decimal points, e.g., 5.00
initialPeriod
string
The length (in days) of the initial billing. Formatted as an integer value, e.g., 5 NOTE: Set to 0 in case of a single and non-recurring transaction.
PARAMETER
language
string
The language the widget will be rendered in. Accepted values: en / es / fr / de / it / ja / ko / zh_tw / zh_cn / pt_br / hi / sv / da / no / nl
NOTE: If the language is not supplied or the supplied language is not supported, the widget will try to determine the language from the browser. If that language is not supported, it will default to English.
theme
string
The theme the widget will be loaded in. Accepted values are ccb-light and ccb-dark
NOTE: If the value is not supplied or is invalid, the system will default to ccb-light. Custom themes are possible; please refer to the theming documentation.
description
string
Optional product description to show in the widget. Up to 500 characters (no HTML/images allowed).
lifeTimeSubscription
string
Indicates whether the transaction is a lifetime subscription or not. Formatted as boolean value 1 or 0
rebills
string
Represents a recurring transaction, rebilling the consumer X times according to the value set. Formatted as an integer value 1 to 99 ("99" being indefinite).
NOTE: When rebills is provided recurringPrice and recurringPeriod become required fields
recurringPrice
string
The recurring price in case of a recurring transaction. Formatted as a float value up to 2 decimal points, e.g., 5.00 It is a required parameter for recurring transactions.
recurringPeriod
string
The recurring period in case of a recurring transaction. Formatted as an integer value, e.g., 5
If all the passed parameters are correct, the following screen appears:
In case of a misconfiguration or if one of the values passed in is not valid, the following screen is displayed:
3. Create Payment Token
Pressing the Place your order button generates a payment token, which passes into the application as a CustomEvent.
To get the data from the widget and use it in an application, add an event listener for a custom event called tokenCreated,which will give you data in the detail property.
When the event is caught, the onGenerateTokenId method is called with data as input, and you can use the payment token.
Creating a charge with this payment token will require adding the customer's IP address as an additional payload (ipAddress) or header (X-Origin-IP) parameter.
4. Customize CSS (Optional)
Customize the appearance of the Payment Widget through a preset Theme or with CSS variables to modify its appearance.
With CSS variables, the widget easily adapts to match the look and feel of a website. This guide will walk you through the customization process, including preset dark and light themes.
Setting the Viewport Meta Tag
The viewport meta tag sets the initial viewport properties for a web page. It helps control how the web page displays on various devices, ensuring the content fits and scales appropriately.
This is crucial for responsive web design and providing a good user experience on different screen sizes and orientations.
You can set up the correct <meta> tag for viewports in the header of the main index.html file.
Preset Light and Dark Themes
The dark or light themes are standard themes with which the widget is shipped. These themes are ready to use as-is without any additional customization.
1. Define the constant and its value in the app.js file using ccb-dark or ccb-lightas values.
2. Add the theme widget attribute to pass the information to the Payment Widget.
Available CSS Variables
To customize the theme further you must link your CSS stylesheet in the index.html file.
You can customize various aspects of the Payment Widget using the following CSS variables:
Feel free to modify these variables according to your website's color scheme and design preferences. Experiment with different values to achieve the desired look for your Payment Widget.
<script src="https://js.ccbill.com/payment-widget/v1/index.js"></script></head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
import React, { useState } from 'react';
import './App.css';