Skip to main content
Once you initialise 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

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 component 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