Widget: HTML

Setting up the widget

To set up the widget with HTML, first you need include this line on the page that will contain the widget:

<script src="https://widget.univapay.com/client/checkout.js"></script>

Then place a <span> element on the page that will contain the widget, with parameters set on the element as data attributes, of the form data-<parameter name>. For example,

<span data-app-id="<TOKEN>"
      data-checkout="payment"
      data-amount="1000"
      data-currency="jpy">
</span>

will set up a widget that will process a payment of 1000 JPY. When the page is opened in a browser, the <span> element will be replaced with a button that will open the widget when clicked.

Widget parameters

Parameters
data-app-idstring (TOKEN)
The application token that is linked to the store for which the widget will process the payment.
Required: Yes
Allowed values: a Authentication Token
data-checkoutstring
Determines which the widget will be used to create just a transaction token (token), both a transaction token and charge/subscription (payment), or both a transaction token and a QR code (qr).
Required: Yes
Allowed values: token, payment, qr
data-payment-typestring
Force the payment type to the given type, bypassing the selection page. The checkout will result in an error if the payment type is not available.
Required: No
Allowed values: card, konbini, paidy, online
data-payment-typesstring
Filters the payment types to the given types. The checkout will result in an error when none of the payment types are available.
Required: No
Allowed values: card, konbini, paidy, online, pay_pay_online, we_chat_online, alipay_online, alipay_plus_online ,bank_transfer separated by comas
data-amountnumber
For a one-time charge, the amount that will be charged. For a regular subscription, the amount that will be charged per period. For subscriptions on installment plans, the total amount that will be charged over all cycles. Note that for currencies that use minor units, you must express the amount in terms of minor units. For example, an amount of 9.50 USD would be expressed as 950.
Required: Yes
Allowed values: Positive integers
data-currencystring (currency code)
The currency for that charge(s) that will be made.
Required: Yes
Allowed values: currency code
data-token-typestring
The type of the transaction token that will be created.
Required: No (defaults to one_time if not set)
Allowed values: one_time, recurring, subscription
data-subscription-periodstring
The period that will be set on the created subscription.
Required: Only if the token type is subscription
Allowed values: daily, weekly, biweekly, monthly, bimonthly, quarterly, semiannually, annually
data-subscription-idstring
Setting this parameter will cause the created transaction token to be patched onto the provided subscription, rather than creating a new subscription.
Required: No
Allowed values: An ID for a subscription on the store that is linked to the application token set on the widget
data-installment-planstring
Setting this parameter will cause the created subscription to use installments, either with a fixed number of cycles (fixed_cycles), a fixed amount per cycle (fixed_cycle_amount), or revolving payments (revolving).
Required: No
Allowed values: fixed_cycles, fixed_cycle_amount, revolving
data-installment-qtynumber
If installment plan is set to fixed_cycles, represents the number of cycles. If installment plan is set to fixed_cycle_amount, represents the amount to charge per cycle.
Required: Only if installment plan is set
Allowed values: Positive integers
data-installment-initial-amountnumber
If the subscription to be created is using an installment plan, this parameter represents the amount to be charged for the first cycle.
Required: No
Allowed values: Positive integers
data-subscription-initial-amountnumber
For subscriptions that do not use installment plans, this parameter represents the amount to be charged for the first charge.
Required: No
Allowed values: Positive integers
data-subscription-startstring
A created subscription’s second charge will occur at this time (the first charge will occur when the subscription is created).
Required: No
Allowed values: Datetime string in ISO8601 format
data-subscription-start-instring
A created subscription’s second charge will occur after this duration (the first charge will occur when the subscription is created). If subscriptionStart is provided, this parameter will be ignored.
Required: No
Allowed values: ISO 8601 duration text
subscription-start-day-of-monthnumber
A created subscription’s second charge will occur on this specific day of the month (the first charge will occur when the subscription is created). Can be use in combination with subscriptionStartIn to start on a later month. When the da of month is in the past and no subscriptionStartIn was provided, the subscription will start on the same day during the next month (or last day if the month number of days is too low). If subscriptionStart is provided, this parameter will be ignored.
Required: No
Allowed values: Number from 1 to 31.
data-textstring
Sets the text on the button that is automatically created when setting up the widget with HTML.
Required: No
Allowed values:
Any string
data-sizestring
Sets the size of the button that is automatically created when setting up the widget with HTML.
Required: No (defaults to normal)
Allowed values:
small, normal, large
data-classstring
Sets the class of the button that is automatically created when setting up the widget with HTML. If this parameter is not set, the button will have no class.
Required: No
Allowed values:
Any string
data-headerstring
Sets the text displayed in the header bar of the widget.
Required: No (defaults to “UnivaPay”)
Allowed values: Any string
data-titlestring
If set, the name of the store in the widget will be replaced by this value.
Required: No (defaults to the name of the store)
Allowed values: Any string
data-namestring
If this is set, then the name of the injected input element that holds the created resource ID upon successfully completing the checkout will be changed to this value. Note that this only applies to the “main” resource created — if only a transaction token was created, the name of the input element will be as specified in the name parameter, or univapayTokenId if not specified. If a subscription or a charge based on a recurring token was created, then the name of the input element will be as specified in the name parameter, or univapaySubscriptionId / univapayChargeId respectively if not specified. The injected element that holds the transaction token ID will always be univapayTokenId in this case.
Required: No
Allowed values: Any string
data-captureboolean
If a single charge is to be created, you can set this parameter to false in order to only authorize the charge without capturing it. The charge can then be captured manually, or automatically if the capture at parameter is set.
Required: No (defaults to true)
Allowed values:true, false
data-capture-atstring
If capture is set to false and this parameter is set, the authorized charge will be automatically captured at the specified time.
Required: No
Allowed values: Datetime string in ISO8601 format
data-emailstring
If an email address is set in this parameter, it will be pre-filled into the email field in the widget’s form.
Required: No
Allowed values: Any email address
data-shipping-address-line1string
If an address line 1 is set in this parameter, it will be pre-filled into the address line 1 field in the widget’s form.
Required: No
Allowed values: Any string
data-shipping-address-line2string
If an address line 2 is set in this parameter, it will be pre-filled into the address line 2 field in the widget’s form.
Required: No
Allowed values: Any string
data-shipping-address-citystring
If an city is set in this parameter, it will be pre-filled into the city field in the widget’s form.
Required: No
Allowed values: Any string
data-shipping-address-statestring
If an state is set in this parameter, it will be pre-filled into the state field in the widget’s form.
Required: No
Allowed values: Any string
data-shipping-address-zipstring
If an zip code is set in this parameter, it will be pre-filled into the Postcode field in the widget’s form.
Required: No
Allowed values: Any string
data-addressboolean
If set to true, the end-user will be prompted to enter their email address and billing address.

Use requireEmail and requireBillingAddress to enable one or the other only.
Required: No (defaults to false)
Allowed values: true, false
data-require-emailboolean
If set to true, the end-user will be prompted to enter their email address.

Required: No (defaults to false)
Allowed values: true, false
data-require-phone-numberboolean
If set to true, the end-user will be prompted to enter their phone number.

Required: No (defaults to false)
Allowed values: true, false
data-require-billing-addressboolean
If set to true, the end-user will be prompted to enter their billing address.

Required: No (defaults to false)
Allowed values: true, false
data-show-cvvboolean
If set to false for a store that does not require a CVV to make a charge, the CVV input field will be hidden on the widget’s form.
Required: No (defaults to true)
Allowed values: true, false
data-localestring
The language that the widget will be displayed in. If set to auto, the browser’s language will be used.
Required: No (defaults to auto)
Allowed values: auto, en-us, ja-jp, zh-tw, zh-cn, en, ja, zh
data-univapay-customer-idstring (UUID)
If this parameter is provided, the end-user will be given an option to save their card data. If they do so, then the transaction token that is created will be associated with the provided customer ID. Then, the next time the widget is opened with the same customer ID, the end-user will be able to select a saved card to complete their transaction. If the token type parameter is set to one_time (or is not set) and the end user elects to save their card data, a recurring token will be created instead. If the token type parameter is set to recurring, then the end-user must elect to save their payment data, or the transaction token will not be created. Note that you must have an infinite recurring token privilege in order to use this parameter.
Required: No
Allowed values: Any UUID
data-cvv-authorizeboolean
If true, an authorization will be automatically made to the gateway to submit the CVV value. If the authorization fails, the token will not be returned. Only valid when checkout is token & token type is recurring.
Required: No (defaults to false)
Allowed values: true, false
data-allow-card-installmentsboolean
If true, card one_time or recurring charge will show an installment select for the user to split the payment into several charges using the card company installments.

Only valid when checkout is payment and when token type is "recurring” or “one_time”. Also, the store must only use card processor for this setting to work.

Required: No (defaults to false)
Allowed values: true, false
data-auto-submitboolean
If true, then when the transaction is completed, the widget will automatically submit the form element that it is called from.
Required: No (defaults to false)
Allowed values: true, false
data-auto-closeboolean
If true, then when the transaction is completed, the widget will automatically close.
Required: No (defaults to false)
Allowed values: true, false
data-usage-limitstring
Sets the usage limit on the recurring transaction token that is created.
Required: Only if creating a recurring transaction token with bounded recurring token privileges
Allowed values: daily, weekly, monthly, annually
data-qr-colorstring (HexColor)
If checkout is set to qr, the QR code will be colored with this color code.
Required: No
Allowed values: Hex color code
data-qr-logo-typestring
If checkout is set to qr, a logo image of the store (or merchant if it isn’t set) will be embedded to the specified position in the QR code.
Required: No (defaults to None)
Allowed values: Background, Centered, None
data-<key>json
Sets metadata on the created transaction token. The format for specifying metadata is different depending on whether you are setting up the widget with HTML or with Javascript. When using HTML, you can specify any data attribute that is not already used by another parameter. For example, setting data-foo = "bar" would set the metadata key foo equal to the value bar. When using Javascript, you must specify a metadata parameter in the call to UnivapayCheckout.create, like so:
UnivapayCheckout.create({ ... metadata: { foo: "bar" } })

data-univapay-reference-id can also be set here for the CSV charges .

Required: No
Allowed values: For HTML, any string. For Javascript, any flat Javascript object