Overview
Learn about the components which are available with Cashfree.js
Once you have initialized the cashfree.js sdk you can use the create method to create a component
Component Lifecycle
Methods
Mount component
A component can be mounted in DOM container
Example
Update component
The values of a component can be updated
Example
Unmount component
To unmount a component from DOM container. Use component.mount to mount again
Get component data
To get the data and state of a component
Returns
Name | Description | Default |
---|---|---|
value | Contains the value of the component. | {} |
error | Contains error that has occurred in the component | undefined |
message | Contains any message that can be shown to the customer | {} |
invalid | Is true is the component is invalid | undefined |
empty | Is true if the component is empty | false |
complete | Is true if the component is complete | false |
ready | Is true if the component is ready for user input | false |
componentName | Contains the type of the component | componentName |
node | Contains the reference to the parent of the component | null |
mounted | Is true if the component has been mounted | false |
Blur component
Trigger blur on component. Can only be applied if kind
of the component is input
Focus component
Trigger focus on component. Can only be applied if kind
of the component is input
Clear component
Trigger clear on component to empty it. Can only be applied if kind
of the component is input
Click component
Trigger click on component. Can only be applied if kind
of the component is button
Disable component
Disabling component will apply the classes.disabled
and style.base[":disabled"]
or style.empty[":disabled"]
to the container and compoent respectively. Can be applied to input
and button
Enable component
To enable a disabled component. Can be applied to input
and button
Destroy component
To destroy a component. Once a component is destroyed it cannot be mounted again
Events
You can register a callback function to various events that occur with a component. The basic syntax is component.on(eventName, callBackFunction)
ready
Triggers when a component is ready for user interaction
focus
Triggers on component kind
input
when focussed
blur
Triggers on component kind
input
when blurred
invalid
Triggers on component kind
input
when value entered by the user is invalid. Callback receives object that has the error. Read more about error here
change
Triggers on component kind
input
whenever change happens for the value
empty
Triggers on component kind
input
when empty
complete
Triggers on component kind
input
when value entered is complete and valid
click
Triggers on component kind
button
when clicked
paymentrequested
Triggers on component payable components when payment has been successfully initiated
loaderror
Triggers on component which could not be mounted. Callback receives object that has the error. Read more about error here
Was this page helpful?