1.113.2 • Published 8 months ago

@paydock/client-sdk v1.113.2

Weekly downloads
697
License
UNLICENSED
Repository
-
Last release
8 months ago

Client-sdk

It is a solution for collecting and handling payment sources in secure way.

With SDK you can create a payment form widget as an independent part or insert use inside your form.

The SDK supports methods for customization of widget by your needs (styling, form fields, etc)

Other information

To work with the widget you will need public_key or access_token (see Authentication)

Also you will need added gateway (see API Reference by gateway)

Get started

The Client SDK ships in JavaScript ES6 (EcmaScript 2015) in three different formats (CJS, ESM and UMD) along with respective TypeScript declarations. Below, we exemplify how to import each format.

With package manager

Our NPM package is compatible with all package managers (e.g., npm, yarn, pnpm, bun). Using npm the following command would add the Client SDK as a production dependency.

npm install @paydock/client-sdk

After installation is complete, if you are developing in NodeJS environments or using tools that expect your JavaScript code to be in CJS format (e.g., Jest, Karma, RequireJS, Webpack), you can import the Client SDK using CommonJS modules. For these environments the UMD format (@paydock/client-sdk/bundles/widget.umd.js) can also be used as a fallback. Alternatively, in case you are developing in projects that have access to modern bundlers such as Vite or others (e.g., SPA libs or SSR Metaframeworks), you can import the Client SDK features using ESM through named imports or namespaced imports.

// module import - CommonJS/Node projects ✅
const paydock = require('@paydock/client-sdk')
const api = new paydock.Api('publicKey');
// named import - ESM projects or TypeScript projects ✅
import { HtmlWidget } from '@paydock/client-sdk'
const widget = new HtmlWidget('#selector', 'publicKey', 'gatewayId');
// namespaced import - ESM projects or TypeScript projects ✅
import * as Paydock from '@paydock/client-sdk'
const widget = new Paydock.HtmlWidget('#selector', 'publicKey', 'gatewayId');
// default import - We do not provide default exports. They are handled differently by different tools!
 ❌
import paydock from '@paydock/client-sdk'
>>> "Uncaught SyntaxError: The requested module does not provide an export named 'default'"

Download from CDN

For browser environments, you can import the Client SDK directly from our CDN to your project's HTML. To accomplish this, include the Client SDK in your page using one and only of the two script tags below. After this step you will be able to access the Client SDK features via the global variable paydock.

For production we recommend using the compressed version (.min.js) since it will result in faster loading times for your end users.

  • Compressed version for production: https://widget.paydock.com/sdk/latest/widget.umd.min.js

  • Full version for development and debug: https://widget.paydock.com/sdk/latest/widget.umd.js

You may download the production version of the Client SDK scripts here, and, the development version here.

For more advanced use-cases, the library has UMD format that can be used in RequireJS, Webpack, etc.

<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js"></script>
<script>
    var widget = new paydock.HtmlWidget('#tag', 'publicKey', 'gatewayId');
</script>

Widget

You can find description of all methods and parameters here

A payment form where it is possible to enter card data/bank accounts and then receive a one-time token for charges, subscriptions etc. This form can be customized, you can customize the fields and set styles. It is possible in real-time to monitor the actions of user with widget and get information about payment-source using events.

Widget simple example

Container

<div id="widget"></div>

You must create a container for the widget. Inside this tag, the widget will be initialized

Initialization

var widget = new paydock.HtmlWidget('#widget', 'publicKey');
widget.load();
// ES2015 | TypeScript

import { HtmlWidget } from '@paydock/client-sdk';

var widget = new HtmlWidget('#widget', 'publicKey');
widget.load();

Then write only need 2 lines of code in js to initialize widget

Full example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>iframe {border: 0;width: 100%;height: 300px;}</style>
</head>
<body>
    <form id="paymentForm">
        <div id="widget"></div>
        <input name="payment_source_token" id="payment_source_token" type="hidden">
    </form>
    <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
    <script>
        var widget = new paydock.HtmlWidget('#widget', 'publicKey');
        widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
        widget.load();
    </script>
</body>
</html>

Widget advanced example

Customization

widget.setStyles({
		background_color: 'rgb(0, 0, 0)',
		border_color: 'yellow',
		text_color: '#FFFFAA',
		button_color: 'rgba(255, 255, 255, 0.9)',
		font_size: '20px'
	});

This example shows how you can customize to your needs and design

Customization from html

<div id="widget"
	 widget-style="text-color: #FFFFAA; border-color: #yellow"
	 title="Payment form"
	 finish-text="Payment resource was successfully accepted"></div>

This example shows how you can set style and texts from html

Settings

widget.setRefId('id'); // your unique identifier to identify the data

widget.setFormFields(['phone', 'email']); // add additional fields for form of widget

widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported card types

This example shows how you can use a lot of other methods to settings your form

Full example

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<style>iframe {border: 0;width: 100%;height: 400px;}</style>
</head>
<body>
<form id="paymentForm">
    <div id="widget"
        widget-style="text-color: #FFFFAA; border-color: #yellow"
        title="Payment form"
        finish-text="Payment resource was successfully accepted"></div>
</form>

<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
<script>
	var widget = new paydock.HtmlWidget('#widget', 'publicKey', 'gatewayId');

	widget.setSupportedCardIcons(['mastercard', 'visa']);
	widget.setFormFields(['phone', 'email']);
	widget.setRefId('custom-ref-id');
    widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');z

	widget.load();
</script>
</script>
</body>
</html>

Classes

Constants

Interfaces

 

IFormValidation

Interface of data from validation event.

Kind: global interface

ParamTypeDescription
eventstringThe name of the event.
message_sourcestringA system variable that identifies the event source.
purposestringA system variable that states the purpose of the event.
ref_idstringCustom unique value that identifies result of processed operation.
form_validbooleanIndicates wether or not the form is valid.
invalid_fieldsArray.<string>Names of form fields with invalid data.
invalid_showed_fieldsArray.<string>Names of invalid form fields which are already displaying the error.
validatorsPartial.<Record.<(CardValidatorValue|GenericValidatorValue), Array.<string>>>Object containing validator identifiers as keys and the fields subject to that validator as an array of form field names. See list of available Generic Vallidators and Card Validators,

 

IEventMetaData

Contains basic information associated with the event and additional meta data specific to the event. E.g., card info, gateway info, etc.

Kind: global interface

ParamTypeDescription
eventstringThe name of the event.
purposestringA system variable that states the purpose of the event.
message_sourcestringA system variable that identifies the event source.
ref_idstringCustom unique value that identifies result of processed operation.
configuration_tokenstringToken received from our API with widget data
typestringPayment type 'card', 'bank_account'
gateway_typestringGateway type
card_number_last4stringLast 4 digit of your card
card_schemestringCard scheme, e.g., (Visa, Mastercard and American Express (AmEx))
card_number_lengthnumberCard number length
account_namestringBank account account name
account_numberstringBank account account number

 

IEventAfterLoadData

Interface of data from event.

Kind: global interface

ParamTypeDescription
eventstringThe name of the event.
purposestringA system variable that states the purpose of the event.
message_sourcestringA system variable that identifies the event source.
ref_idstringCustom unique value that identifies result of processed operation.

 

IEventFinishData

Interface of data from event.

Kind: global interface

ParamTypeDescription
eventstringThe name of the event.
purposestringA system variable that states the purpose of the event.
message_sourcestringA system variable that identifies the event source.
ref_idstringCustom unique value that identifies result of processed operation.
payment_sourcestringOne time token. Result from this endpoint API docs

 

IPayPalMeta

Interface for PayPal checkout meta information

Kind: global interface

ParamTypeDescription
brand_namestringA label that overrides the business name in the PayPal account on the PayPal hosted checkout pages
cart_border_colorstringThe HTML hex code for your principal identifying color
referencestringMerchant Customer Service number displayed on the PayPal pages
emailstringThe consumer’s email
hdr_imgstringURL for the image you want to appear at the top left of the payment page
logo_imgstringA URL to your logo image
pay_flow_colorstringSets the background color for the payment page. By default, the color is white.
first_namestringThe consumer’s given names
last_namestringThe consumer’s surname
address_linestringStreet address
address_line2stringSecond line of the address
address_citystringCity
address_statestringState
address_postcodestringPostcode
address_countrystringCountry
phonestringThe consumer’s phone number in E.164 international notation (Example: +12345678901)
hide_shipping_addressbooleanDetermines whether PayPal displays shipping address fields on the PayPal pages

 

IStyles

Interface for classes that represent widget's styles.

Kind: global interface

ParamType
background_colorstring
text_colorstring
border_colorstring
button_colorstring
error_colorstring
success_colorstring
font_sizestring
font_familystring

 

ITexts

Interface for classes that represent widget's text.

Kind: global interface

ParamType
titlestring
title_h1string
title_h2string
title_h3string
title_h4string
title_h5string
title_h6string
finish_textstring
title_descriptionstring
submit_buttonstring
submit_button_processingstring

 

IBamboraMeta

Interface for Bamboora meta information

Kind: global interface

ParamTypeDescription
customer_storage_numberstringCustomer storage number
tokenise_algorithmnumberTokenise algorithm

 

IElementStyleInput

Interface for styling input element.

Kind: global interface

ParamTypeDescription
colorstringLook more mozilla.org/color
borderstringLook more mozilla.org/color
border_radiusstringLook more mozilla.org/color
background_colorstringLook more mozilla.org/color
heightstringLook more mozilla.org/color
text_decorationstringLook more mozilla.org/color
font_sizestringLook more mozilla.org/color
font_familystringLook more mozilla.org/color
transitionstringLook more mozilla.org/color
line_heightstringLook more mozilla.org/color
font_weightstringLook more mozilla.org/color
paddingstringLook more mozilla.org/color
marginstringLook more mozilla.org/color

 

IElementStyleSubmitButton

Interface for styling submit_button element.

Kind: global interface

ParamTypeDescription
colorstringLook more mozilla.org/color
borderstringLook more mozilla.org/color
border_radiusstringLook more mozilla.org/color
background_colorstringLook more mozilla.org/color
text_decorationstringLook more mozilla.org/color
font_sizestringLook more mozilla.org/color
font_familystringLook more mozilla.org/color
paddingstringLook more mozilla.org/color
marginstringLook more mozilla.org/color
transitionstringLook more mozilla.org/color
line_heightstringLook more mozilla.org/color
font_weightstringLook more mozilla.org/color
opacitystringLook more mozilla.org/color

 

IElementStyleLabel

Interface for styling label element.

Kind: global interface

ParamTypeDescription
colorstringLook more mozilla.org/color
text_decorationstringLook more mozilla.org/color
font_sizestringLook more mozilla.org/color
font_familystringLook more mozilla.org/color
line_heightstringLook more mozilla.org/color
font_weightstringLook more mozilla.org/color
paddingstringLook more mozilla.org/color
marginstringLook more mozilla.org/color

 

IElementStyleTitle

Interface for styling title element.

Kind: global interface

ParamTypeDescription
colorstringLook more mozilla.org/color
text_decorationstringLook more mozilla.org/color
font_sizestringLook more mozilla.org/color
font_familystringLook more mozilla.org/color
line_heightstringLook more mozilla.org/color
font_weightstringLook more mozilla.org/color
paddingstringLook more mozilla.org/color
marginstringLook more mozilla.org/color
'text-align',stringLook more mozilla.org/color

 

IElementStyleTitleDescription

Interface for styling title_description element.

Kind: global interface

ParamTypeDescription
colorstringLook more mozilla.org/color
text_decorationstringLook more mozilla.org/color
font_sizestringLook more mozilla.org/color
font_familystringLook more mozilla.org/color
line_heightstringLook more mozilla.org/color
font_weightstringLook more mozilla.org/color
paddingstringLook more mozilla.org/color
marginstringLook more mozilla.org/color
'text-align',stringLook more mozilla.org/color

 

ITriggerData

Interface for classes that represent a trigger data.

Kind: global interface

ParamType
configuration_tokenstring
tab_numberstring
elementsstring
form_valuesstring

 

HtmlWidget ⇐ HtmlMultiWidget

Class Widget include method for working on html and include extended by HtmlMultiWidget methods

Kind: global class
Extends: HtmlMultiWidget, MultiWidget

 

new HtmlWidget(selector, publicKey, gatewayID, paymentType, purpose)

ParamTypeDefaultDescription
selectorstringSelector of html element. Container for widget
publicKeystringPayDock users public key
gatewayIDstring"default"ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token.
paymentTypestring"card"Type of payment source which shows in widget form. Available parameters : “card”, “bank_account”.
purposestring"payment_source"Purpose of widget form. Available parameters: ‘payment_source’, ‘card_payment_source_with_cvv’, ‘card_payment_source_without_cvv’

Example

var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID'); // short

var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID', 'bank_account', 'payment_source'); // extend

var widget = new HtmlWidget('#widget', 'publicKey', 'not_configured'); // without gateway

 

htmlWidget.setWebHookDestination(url)

Destination, where customer will receive all successful responses. Response will contain “data” object with “payment_source” or other parameters, in depending on 'purpose'

Kind: instance method of HtmlWidget

ParamTypeDescription
urlstringYour endpoint for post request.

Example

widget.setWebHookDestination('http://google.com');

 

htmlWidget.setSuccessRedirectUrl(url)

URL to which the Customer will be redirected to after the success finish

Kind: instance method of HtmlWidget

ParamType
urlstring

Example

widget.setSuccessRedirectUrl('google.com/search?q=success');

 

htmlWidget.setErrorRedirectUrl(url)

URL to which the Customer will be redirected to if an error is triggered in the process of operation

Kind: instance method of HtmlWidget

ParamType
urlstring

Example

widget.setErrorRedirectUrl('google.com/search?q=error');

 

htmlWidget.setFormFields(fields)

Set list with widget form field, which will be shown in form. Also you can set the required validation for these fields

Kind: instance method of HtmlWidget

ParamTypeDescription
fieldsArray.<string>name of fields which can be shown in a widget. If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) FORM_FIELD

Example

widget.setFormFields(['phone', 'email', 'first_name*']);

 

htmlWidget.setFormElements(elements)

The method to set the full configuration for the all specific form elements (visibility, required, label, placeholder, value) You can also use the other method for the partial configuration like: setFormFields, setFormValues, setFormPlaceholder, setFormLabel

Kind: instance method of HtmlWidget
Overrides: setFormElements

ParamTypeDescription
elementsArray.<Object>List of elements
elements[].fieldstringField name of element. If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) FORM_FIELD
elements[].placeholderstringSet custom placeholders in form fields
elements[].labelstringSet a custom labels near the form field
elements[].valuestringSet predefined values for the form field

Example

widget.setFormElements([
      {
          field:  'card_name*',
          placeholder: 'Input your card holder name...',
          label: 'Card Holder Name',
          value: 'Houston',
      },
      {
          field:  'email',
          placeholder: 'Input your email, like test@example.com',
          label: 'Email for the receipt',
          value: 'predefined@email.com',
      },
  ])

 

htmlWidget.setMeta(object)

The method to set meta information for the checkout page

Kind: instance method of HtmlWidget

ParamTypeDescription
objectIPayPalMeta | IBamboraMetadata which can be shown on checkout page IPayPalMeta IBamboraMeta

Example

config.setMeta({
            brand_name: 'paydock',
            reference: '15',
            email: 'wault@paydock.com'
        });

 

htmlWidget.load()

Loads the widget.

Calling this method results in an iframe element being inserted and rendered in the DOM.

Kind: instance method of HtmlWidget
Overrides: load
 

htmlWidget.afterLoad()

Registers a form validation callback for validation events.

Kind: instance method of HtmlWidget
Overrides: afterLoad
 

htmlWidget.trigger(triggers, data)

Registers callback that will be invoked for every trigger.

Kind: instance method of HtmlWidget
Overrides: trigger

ParamTypeDescription
triggers'submit_form' | 'tab'The Widget element identifier that caused the trigger.
dataITriggerDataData that will be sent to the widget when the trigger occurs.

 

htmlWidget.getValidationState() ⇒ IFormValidation

Gets a reference to the form current validation state.

!Warning: do not directly modify the values of the returned object.

Kind: instance method of HtmlWidget
Overrides: getValidationState
Returns: IFormValidation - Form validation object
 

htmlWidget.isValidForm() ⇒ boolean

Checks if a given form is valid.

A form is valid if all form fields are valid.

Kind: instance method of HtmlWidget
Overrides: isValidForm
Returns: boolean - Indicates wether or not form is valid.
 

htmlWidget.isInvalidField(field) ⇒ boolean

Using this method you can check if a specific form field is invalid

Kind: instance method of HtmlWidget
Overrides: isInvalidField
Returns: boolean - Field is invalid

ParamTypeDescription
fieldstringField name

 

htmlWidget.isFieldErrorShowed(field) ⇒ boolean

Checks if a given form field is displaying an error.

Kind: instance method of HtmlWidget
Overrides: isFieldErrorShowed
Returns: boolean - Indicates wether or not the Error message is being displayed on the associated field.

ParamTypeDescription
fieldstringThe form field name

 

htmlWidget.isInvalidFieldByValidator(field, validator) ⇒ boolean

Checks if a given form field is valid or invalid by name.

Kind: instance method of HtmlWidget
Overrides: isInvalidFieldByValidator
Returns: boolean - Indicates wether or not the field is invalid based on validator intepretation.

ParamTypeDescription
fieldstringThe form field name
validatorThe name of the validator.

 

htmlWidget.hide(saveSize)

Hides the widget.

E.g., use this method to hide the widget after it loads.

Kind: instance method of HtmlWidget
Overrides: hide

ParamTypeDefaultDescription
saveSizebooleanfalseWether the original iframe element size should be saved before being hidden.

 

htmlWidget.show()

Shows the widget.

E.g., use this method to show the widget after it was explicitly hidden.

Kind: instance method of HtmlWidget
Overrides: show
 

htmlWidget.reload()

Reloads the widget.

Kind: instance method of HtmlWidget
Overrides: reload
 

htmlWidget.hideElements(elements)

Hides the specified Widget elements by their identifier.

Kind: instance method of HtmlWidget
Overrides: hideElements

ParamTypeDescription
elementsArray.<string>List of element which can be hidden ELEMENTFORM_FIELD

Example

widget.hideElements(['submit_button', 'email']);

 

htmlWidget.showElements(elements)

Shows the specified Widget elements by their identifier.

Kind: instance method of HtmlWidget
Overrides: showElements

ParamTypeDescription
elementsArray.<string>List of elements which can be showed ELEMENTFORM_FIELD

Example

widget.showElements(['submit_button', 'email']);

 

htmlWidget.updateFormValues(fieldValues)

Updates the form field values inside the widget.

Kind: instance method of HtmlWidget
Overrides: updateFormValues

ParamTypeDescription
fieldValuesIFormValuesFields with values

Example

widget.updateFormValues({
  email: 'predefined@email.com',
  card_name: 'Houston'
});

 

htmlWidget.updateFormValue(key, value)

Updates a single form field values inside the widget by the form field name.

Kind: instance method of HtmlWidget
Overrides: updateFormValue

ParamTypeDescription
keystringThe form field name
valuestringThe form field value

Example

widget.updateFormValue("card_name", "John Doe");

 

htmlWidget.onFinishInsert(selector, dataType)

Inserts the event data (after finish event) onto the input field associated with the provided CSS selector.

Kind: instance method of HtmlWidget
Overrides: onFinishInsert

ParamTypeDescription
selectorstringA CSS selector. E.g., ".my-class", "#my-id", or others
dataTypestringThe data type of IEventData object.

 

htmlWidget.interceptSubmitForm(selector)

Intercepts a form submission and delegates processing to the widget.

An simplified example of the process:

  • User clicks submit button in your form
  • This implicitly triggers a submission to the widget
  • The widget submits your form

Kind: instance method of HtmlWidget
Overrides: interceptSubmitForm
Note: The widget's submit button will be hidden.

ParamTypeDescription
selectorstringcss selector of your form

Example

<body>
 <form id="myForm">
     <input name="amount">
     <button type="submit">Submit</button>
 </form>
 <script>
    widget.interceptSubmitForm('#myForm');
 </script>
</body>

 

htmlWidget.useCheckoutAutoSubmit()

This method hides a submit button and automatically execute form submit

Kind: instance method of HtmlWidget
Overrides: useCheckoutAutoSubmit
 

htmlWidget.useAutoResize()

Use this method for resize iFrame according content height

Kind: instance method of HtmlWidget
Overrides: useAutoResize
Example

widget.useAutoResize();

 

htmlWidget.setStyles(fields)

Object contain styles for widget

Kind: instance method of HtmlWidget
Overrides: setStyles

ParamTypeDescription
fieldsIStylesname of styles which can be shown in widget STYLE

Example

widget.setStyles({
      background_color: 'rgb(0, 0, 0)',
      border_color: 'yellow',
      text_color: '#FFFFAA',
      button_color: 'rgba(255, 255, 255, 0.9)',
      font_size: '20px'
      fort_family: 'fantasy'
  });

 

htmlWidget.usePhoneCountryMask(options)

Method to set a country code mask for the phone input.

Kind: instance method of HtmlWidget
Overrides: usePhoneCountryMask

ParamTypeDescription
optionsobjectOptions for configure the phone mask.
options.default_countrystringSet a default country for the mask.
options.preferred_countriesArray.<string>Set list of preferred countries for the top of the select box .
options.only_countriesArray.<string>Set list of countries to show in the select box.

Example

widget.usePhoneCountryMask();

Example

widget.usePhoneCountryMask({
      default_country: 'au',
      preferred_countries: ['au', 'gb'],
      only_countries: ['au', 'gb', 'us', 'ua']
  });

 

htmlWidget.setTexts(fields)

Method for set different texts inside the widget

Kind: instance method of HtmlWidget
Overrides: setTexts

ParamTypeDescription
fieldsITextsname of text items which can be shown in widget TEXT

Example

widget.setTexts({
      title: 'Your card',
      finish_text: 'Payment resource was successfully accepted',
      title_description: '* indicates required field',
      submit_button: 'Save',
      submit_button_processing: 'Load...',
  });

 

htmlWidget.setElementStyle(element, state, styles)

Method for set styles for different elements and states

Kind: instance method of HtmlWidget
Overrides: setElementStyle

ParamTypeDescription
elementstringtype of element for styling. These elements are available STYLABLE_ELEMENT
statestringstate of element for styling. These states are available STYLABLE_ELEMENT_STATE
stylesIElementStyleInput | IElementStyleSubmitButton | IElementStyleLabel | IElementStyleTitle | IElementStyleTitleDescriptionstyles list

Example

widget.setElementStyle('input', {
  border: 'green solid 1px'
});

widget.setElementStyle('input', 'focus', {
  border: 'blue solid 1px'
});

widget.setElementStyle('input', 'error', {
 border: 'red solid 1px'
});

 

htmlWidget.setFormValues(fieldValues)

The method to set the predefined values for the form fields inside the widget

Kind: instance method of HtmlWidget
Overrides: setFormValues

ParamTypeDescription
fieldValuesObjectKey of object is one of FORM_FIELD, The object value is what we are expecting

Example

widget.setFormValues({
      email: 'predefined@email.com',
      card_name: 'Houston'
  });

 

htmlWidget.setFormLabels(fieldLabels)

The method to set custom form field labels

Kind: instance method of HtmlWidget
Overrides: setFormLabels

ParamTypeDescription
fieldLabelsObjectKey of object is one of FORM_FIELD, The object value is what we are expecting

Example

widget.setFormPlaceholders({
      card_name: 'Card Holder Name',
      email: 'Email For Receipt'
  })

 

htmlWidget.setFormPlaceholders(fieldPlaceholders)

The method to set custom form fields placeholders

Kind: instance method of HtmlWidget
Overrides: setFormPlaceholders

ParamTypeDescription
fieldPlaceholdersObjectKey of object is one of FORM_FIELD, Value of object is expected placeholder

Example

widget.setFormPlaceholders({
      card_name: 'Input your card holder name...',
      email: 'Input your email, like test@example.com'
  })

 

htmlWidget.setIcons()

Deprecated

The method to change the widget icons

Kind: instance method of HtmlWidget
Overrides: setIcons
 

htmlWidget.setHiddenElements(elements)

Using this method you can set hidden elements inside widget

Kind: instance method of HtmlWidget
Overrides: setHiddenElements

ParamTypeDescription
elementsArray.<string>list of element which can be hidden ELEMENTFORM_FIELD

Example

widget.setHiddenElements(['submit_button', 'email']);

 

htmlWidget.setRefId(refId)

Current method can set custom ID to identify the data in the future

Kind: instance method of HtmlWidget
Overrides: setRefId

ParamTypeDescription
refIdstringcustom id

Example

widget.setRefId('id');

 

htmlWidget.useGatewayFieldValidation()

Current method can add visual validation from gateway to widget's form fields

Kind: instance method of HtmlWidget
Overrides: useGatewayFieldValidation
Example

widget.useGatewayFieldValidation();

 

htmlWidget.setSupportedCardIcons(elements, validateCardNumberInput)

Current method can set icons of supported card types

Kind: instance method of HtmlWidget
Overrides: setSupportedCardIcons

ParamTypeDescription
elementsArray.<string>SUPPORTED_CARD_TYPES
validateCardNumberInputbooleanvalidateCardNumberInput=false - using this param you allow validation for card number input on supported card types

Example

widget.setSupportedCardIcons(['mastercard', 'visa'], validateCardNumberInput);

 

htmlWidget.setEnv(env, alias)

Current method can change environment. By default environment = sandbox. Also we can change domain alias for this environment. By default domain_alias = paydock.com

Kind: instance method of HtmlWidget
Overrides: setEnv

ParamTypeDescription
envstringsandbox, production
aliasstringOwn domain alias

Example

widget.setEnv('production', 'paydock.com');

 

htmlWidget.loadIFrameUrl()

Method for creating iframe url

Kind: instance method of HtmlWidget
Overrides: loadIFrameUrl
Example

widget.loadIFrameUrl(function (url) {
     console.log(url);
}, function (errors) {
     console.log(errors);
});

 

htmlWidget.setLanguage(code)

Method for setting a custom language code

Kind: instance method of HtmlWidget
Overrides: setLanguage

ParamTypeDescription
codestringISO 639-1

Example

config.setLanguage('en');

 

HtmlMultiWidget ⇐ MultiWidget

Class HtmlMultiWidget include method for working with html

Kind: global class
Extends: MultiWidget

 

new HtmlMultiWidget(selector, publicKey, conf)

ParamTypeDescription
selectorstringSelector of html element. Container for widget
publicKeystringPayDock users public key
confConfiguration | string | Array.<Configuration> | Array.<string>exemplars Configuration class OR configuration token

Example

var widget = new MultiWidget('#widget', 'publicKey','configurationToken'); // With a pre-created configuration token

var widget = new MultiWidget('#widget', 'publicKey',['configurationToken', 'configurationToken2']); // With pre-created configuration tokens

var widget = new MultiWidget('#widget', 'publ
1.115.0-beta

8 months ago

1.113.2

8 months ago

1.113.2-beta

8 months ago

1.112.0

9 months ago

1.104.6-beta

1 year ago

1.103.1

1 year ago

1.106.1-beta

1 year ago

1.103.11-beta

1 year ago

1.102.1

1 year ago

1.106.11-beta

1 year ago

1.108.2-beta

11 months ago

1.105.1

1 year ago

1.103.1-beta

1 year ago

1.102.0-beta

1 year ago

1.104.7-beta

1 year ago

1.104.9-beta

12 months ago

1.108.0-beta

12 months ago

1.107.1

1 year ago

1.107.0

1 year ago

1.102.1-beta

1 year ago

1.108.2

11 months ago

1.111.1

9 months ago

1.106.2

1 year ago

1.106.1

1 year ago

1.108.1-beta

12 months ago

1.103.24-beta

1 year ago

1.111.0-beta

10 months ago

1.110.2

10 months ago

1.104.3-beta

1 year ago

1.110.3

10 months ago

1.101.1

1 year ago

1.104.1-beta

1 year ago

1.107.0-beta

1 year ago

1.110.3-beta

10 months ago

1.100.0

1 year ago

1.108.1

11 months ago

1.106.11

1 year ago

1.94.22

2 years ago

1.91.11

2 years ago

1.89.27-beta

2 years ago

1.90.1

2 years ago

1.91.11-beta

2 years ago

1.87.3-beta

2 years ago

1.87.3

2 years ago

1.86.5

2 years ago

1.86.5-beta

2 years ago

1.84.10

2 years ago

1.83.31

3 years ago

1.84.8-beta

3 years ago

1.84.8

2 years ago

1.84.9

2 years ago

1.83.31-beta

3 years ago

1.79.2

3 years ago

1.80.13-beta

3 years ago

1.79.2-beta

3 years ago

1.79.1-beta

3 years ago

1.80.13

3 years ago

1.81.1

3 years ago

1.11.12-beta

3 years ago

1.11.13-beta

3 years ago

1.11.8

3 years ago

1.77.2

3 years ago

1.77.3

3 years ago

1.11.9-beta

3 years ago

1.11.7

3 years ago

1.10.83-beta-02

3 years ago

1.11.4

3 years ago

1.11.5-beta

3 years ago

1.10.83-beta-01

3 years ago

1.10.89-beta

3 years ago

1.10.86-beta

3 years ago

1.11.1-beta

3 years ago

1.11.2

3 years ago

1.10.83-patch

3 years ago

1.10.88-beta

3 years ago

1.10.88-1.1-beta

3 years ago

1.10.84

3 years ago

1.11.3-beta

3 years ago

1.10.87-beta

3 years ago

1.11.2-beta

3 years ago

1.10.84-patch

3 years ago

1.10.83-beta

3 years ago

1.10.79-beta

3 years ago

1.10.73-beta

3 years ago

1.10.80-beta

3 years ago

1.10.74-beta

3 years ago

1.10.77-beta

3 years ago

1.10.76-beta

3 years ago

1.10.83

3 years ago

1.10.73

3 years ago

1.10.71

3 years ago

1.10.72-beta

3 years ago

1.10.77

3 years ago

1.10.78-beta

3 years ago

1.10.81-beta

3 years ago

1.10.82-beta

3 years ago

1.10.57-beta

4 years ago

1.10.58-beta

4 years ago

1.10.60-beta

4 years ago

1.10.59

4 years ago

1.10.56

4 years ago

1.10.56-beta

4 years ago

1.10.55-beta

4 years ago

1.10.54

4 years ago

1.10.51-beta

4 years ago

1.10.54-beta

4 years ago

1.10.53

4 years ago

1.10.50-beta

4 years ago

1.10.52-beta

4 years ago

1.10.48-beta

4 years ago

1.10.47-beta

4 years ago

1.10.31

4 years ago

1.10.45-beta

4 years ago

1.10.46-beta

4 years ago

1.10.44-beta

4 years ago

1.10.43-beta

4 years ago

1.10.30

4 years ago

1.10.42-beta

4 years ago

1.10.40-beta

4 years ago

1.10.39-beta

4 years ago

1.10.41-beta

4 years ago

1.10.38-beta

4 years ago

1.10.29

4 years ago

1.10.36-beta

4 years ago

1.10.28

4 years ago

1.10.37-beta

4 years ago

1.10.27

4 years ago

1.10.34-beta

4 years ago

1.10.33-beta

4 years ago

1.10.26

4 years ago

1.10.31-beta

4 years ago

1.10.30-beta

4 years ago

1.10.25

4 years ago

1.10.29-beta

4 years ago

1.10.27-beta

4 years ago

1.10.24-beta

4 years ago

1.10.17

4 years ago

1.10.19-beta

4 years ago

1.10.20-beta

4 years ago

1.10.16-beta

4 years ago

1.10.15-beta

4 years ago

1.10.14-beta

4 years ago

1.10.18-beta

4 years ago

1.10.17-beta

4 years ago

1.10.15

4 years ago

1.10.16

4 years ago

1.10.13

4 years ago

1.10.12-beta

4 years ago

1.10.12

4 years ago

1.10.11-beta

4 years ago

1.10.10-beta

4 years ago

1.10.11

4 years ago

1.10.10

4 years ago

1.10.9

4 years ago

1.10.9-beta

4 years ago

1.10.5

4 years ago

1.10.4

4 years ago

1.10.8-beta

4 years ago

1.10.7-beta

4 years ago

1.10.5-beta

4 years ago

1.10.4-beta

4 years ago

1.9.1

5 years ago

1.9.1-build-beta

5 years ago

1.8.2

5 years ago

1.8.2-build-beta

5 years ago

1.8.1

5 years ago

1.8.0

5 years ago

1.7.8

5 years ago

1.3.2

5 years ago

1.3.1-beta

5 years ago

1.2.12-beta

5 years ago

1.2.11-beta

5 years ago

1.2.10

5 years ago

1.2.10-beta

5 years ago

1.2.9-beta

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.8-beta

5 years ago

1.2.7-beta

5 years ago

1.2.6

6 years ago

1.2.4-beta

6 years ago

1.2.3-beta

6 years ago

1.2.1-beta

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.18

6 years ago

1.1.17

6 years ago

1.1.16

7 years ago

1.1.15

7 years ago

1.1.14

7 years ago

1.1.13

7 years ago

1.1.12

7 years ago

1.1.10

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

0.4.26

8 years ago

0.4.25

8 years ago

0.4.24

8 years ago

0.4.23

8 years ago

0.4.22

8 years ago

0.4.21

8 years ago

0.4.20

8 years ago

0.4.19

8 years ago

0.4.18

8 years ago

0.4.17

8 years ago

0.4.16

8 years ago

0.4.15

8 years ago

0.4.14

8 years ago

0.4.13

8 years ago

0.4.12

8 years ago

0.4.11

8 years ago

0.4.9

8 years ago

0.4.8

8 years ago

0.4.7

8 years ago

0.4.6

8 years ago

0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.9

8 years ago

0.3.8

8 years ago

0.3.7

8 years ago

0.3.6

8 years ago

0.3.5

8 years ago

0.3.0

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago