new ChimoneyWidget(options)
Creates an instance of ChimoneyWidget.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Configuration options for the widget.
Properties
|
- 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