Class: ChimoneyWidget

ChimoneyWidget(options)

new ChimoneyWidget(options)

Creates an instance of ChimoneyWidget.
Parameters:
Name Type Description
options Object Configuration options for the widget.
Properties
Name Type Attributes Default Description
paymentLink string The URL to the Chimoney payment page, required for initializing the widget. This must be a valid URL.
onPaymentSuccess string The callback after payment is completed. This must be a valid function.
onWidgetClosed string The callback when modal is closed. This must be a valid function.
brandColor string <optional>
'#000' Customize the primary color of the payment widget to match your brand theme. Default is black.
brandName string <optional>
'Chimoney' Your brand's name, which will be displayed on the widget to enhance trust. Default is 'Chimoney'.
Source:
Throws:
Throws an error if the paymentLink is not provided or is invalid.
Type
Error
Example
const chimoneyPay = new ChimoneyWidget({
  paymentLink: 'https://dash.chimoney.io/pay?issueID=your_unique_issue_id',
  brandColor: '#FF5722',
  brandName: 'Your Brand'
});

Methods

close()

Closes the modal containing the iframe. This method hides the modal, effectively closing the payment interface.
Source:

createModal()

Creates and appends the modal element to the DOM. The modal serves as a container for the iframe.
Source:

isValidUrl(url) → {boolean}

Checks if a URL is valid.
Parameters:
Name Type Description
url string The URL to validate.
Source:
Returns:
True if the URL is valid, false otherwise.
Type
boolean

open()

Opens the modal containing the iframe. This method makes the modal visible, showing the payment interface.
Source:

validateOptions(options)

Validates the options object, particularly the `paymentLink`.
Parameters:
Name Type Description
options Object The options provided to the constructor.
Source:
Throws:
If the `paymentLink` is missing or invalid.
Type
Error

ChimoneyWidget(options)

new ChimoneyWidget(options)

Constructs the ChimoneyWidget with user-provided options. Validates the mandatory `paymentLink` parameter. Initializes modal and iframe components.
Parameters:
Name Type Description
options Object Configuration options for the widget.
Properties
Name Type Attributes Default Description
paymentLink string The URL to the Chimoney payment page.
onPaymentSuccess string The callback after payment is completed.
onWidgetClosed string The callback when modal is closed.
brandColor string <optional>
'#000' Primary color of the widget, default is black.
brandName string <optional>
'Chimoney' Name of the brand, default is 'Chimoney'.
Source:
Throws:
If `paymentLink` is not provided or invalid.
Type
Error

Methods

close()

Closes the modal containing the iframe. This method hides the modal, effectively closing the payment interface.
Source:

createModal()

Creates and appends the modal element to the DOM. The modal serves as a container for the iframe.
Source:

isValidUrl(url) → {boolean}

Checks if a URL is valid.
Parameters:
Name Type Description
url string The URL to validate.
Source:
Returns:
True if the URL is valid, false otherwise.
Type
boolean

open()

Opens the modal containing the iframe. This method makes the modal visible, showing the payment interface.
Source:

validateOptions(options)

Validates the options object, particularly the `paymentLink`.
Parameters:
Name Type Description
options Object The options provided to the constructor.
Source:
Throws:
If the `paymentLink` is missing or invalid.
Type
Error