Widget overview

The widget provides an interface for customers to make transaction tokens, charges, and subscriptions for a store. Based on the parameters that are used to create the widget and the configuration options set on the store, the customer will be presented with a form where they can enter their payment details (credit card number, address, email, and so on). The widget will use the Javascript SDK to make the required requests to the API and create the necessary resources. Finally, the widget will display to the customer a success or failure screen, depending on the result of the API requests.

Setting up the widget

There are two ways that the widget can be set up: via an HTML element or with a Javascript function.

Using the widget

When the customer opens the widget, they will be prompted to fill out a form with their payment information. Upon submitting the form, the widget will make requests to the API to create the resources necessary (a transaction token, and possibly a charge or a subscription). If all resources are created successfully, the IDs of the created transaction token will be injected into the page in the form of a hidden input element. Additionally, if a subscription was created or a charge was created with a recurring token, then the IDs of the subscription/charge will also be injected into the page. For details on the names of these injected elements, see documentation on the name parameter below.

The logo displayed at the top of the widget can be specified in the store settings. If no logo is set in the store, the one set in the general settings will be used. If neither of these logos are set, a default logo will be displayed.