Checkout object

🚧

Our new version of Mollie Components is in private beta.

If you are interested in early access you can reach out to us. Looking to embed a card form with Mollie.JS V1? See Embedding a card form.

The checkout object is the client side representation of the Session. It can be used to create one or more components which can be mounted in your checkout.

Checkout(clientToken, options?)

To create a Checkout object, use Mollie.Checkout(clientToken, options?). The client token can be generated by creating a Session from your backend by calling the Sessions API.

const checkout = Mollie.Checkout("eyJzZXNzaW9uVG9rZW4X...", { locale: 'en-US' });
📘

Compatibility mode

If you have loaded Mollie.js in compatibility mode, you can initialize calling Mollie2.Checkout(clientToken, options?)

Parameters


clientToken string required

The client token from the Session. Create a Session via the Sessions API to retrieve a token.


options object

Initialization options.

Options

locale string

The locale of the customer. Used for localizing the component.


Methods


.create(componentType: string, options: object): ComponentInstance

Creates a new component.


.on(event: string, handler: Function): this

Subscribes to checkout events.


.off(event: string, handler?: Function): this

Unsubscribes from checkout events.


Events

You can listen for events via .on(eventName, handler).


.on('submit', handler)

The submit event is triggered before the Session will create a payment. You can pause the processing of the payment while you trigger any logic in your system and decide to continue processing or canceling.

Handler parameters

defer function

A function that is called if the process of the payment should be paused.


resolve function

A function that is called if the payment should be processed.


reject function

A function that is called if the payment should be aborted.