PesepayElementBase
What every element can do: mount, update, focus, clear and send events.
create() does not mount, so you can set an element up before its
container exists. Each element’s page lists the events it sends.
Your page cannot read what the customer typed: card details stay in
Pesepay’s frame. Pass the element to confirmCardPayment() to pay.
export interface PesepayElementBase<Events extends ElementEventMap = ElementEventMap, Options = BaseElementOptions>Properties
Section titled “Properties”| Name | Type | Description |
|---|---|---|
elementType | ElementType | The kind of element. |
Methods
Section titled “Methods”blur()
Section titled “blur()”blur(): void;Removes focus from the element.
clear()
Section titled “clear()”clear(): void;Clears what the customer has entered.
destroy()
Section titled “destroy()”destroy(): void;Unmounts and releases everything. The element cannot be reused.
focus()
Section titled “focus()”focus(): void;Moves focus into the element.
mount()
Section titled “mount()”mount(target: string | HTMLElement): void;Renders into a CSS selector or an element. Throws if the target is missing.
| Parameter | Type |
|---|---|
target | string | HTMLElement |
off<K extends keyof Events>(type: K, handler?: (event: Events[K]) => void): this;Omitting the handler removes every listener for that event.
| Parameter | Type |
|---|---|
type | K |
handler? | (event: Events[K]) => void |
on<K extends keyof Events>(type: K, handler: (event: Events[K]) => void): this;Adds a listener. Returns the element, so calls chain.
| Parameter | Type |
|---|---|
type | K |
handler | (event: Events[K]) => void |
once()
Section titled “once()”once<K extends keyof Events>(type: K, handler: (event: Events[K]) => void): this;Adds a listener that runs once. Returns the element, so calls chain.
| Parameter | Type |
|---|---|
type | K |
handler | (event: Events[K]) => void |
unmount()
Section titled “unmount()”unmount(): void;Removes the element from the DOM. It can be mounted again.
update()
Section titled “update()”update(options: Partial<Options>): void;Changes some options. Options you leave out keep their values.
| Parameter | Type |
|---|---|
options | Partial<Options> |