Create Card CVC Element

createElement('cvc', options?)

Use this function to create an instance of an individual Element.

Parameters

typerequired'cvc'

The type of element you are creating.

optionsoptionalCvcElementOptions

Options for creating cvc Element.

Returns

CvcElement | null
linkTypeScript
1import { createElement } from '@airwallex/components-sdk';
2const element = createElement('cvc');

CvcElementOptions

Applies to split card element type integration, the interface used when createElement() called with type cvc.

authFormContaineroptionalstring

The container id of the authentication form used in 3D Secure authentication.

cvcLengthoptionalnumber

Indicate cvc length.

disabledoptionalboolean

Whether the cvc Element input is disabled or not. Default value is false.

isStandaloneoptionalboolean

Whether cvc Element works alone or not. If you want to use the CVC Element for a saved Payment Consent, you could set it true to improve the checkout experience.

placeholderoptionalstring

A short hint to suggest the expected value of an input field to the shopper.

styleoptional

Style for the cvc Element.

CvcElement

Element functions can be used in your integration flow with Airwallex element.

blur()

Using this function to blur the HTML Input element.

Returns

void
linkTypeScript
1element.blur();

clear()

Using this function to clear the HTML Input element.

Returns

void
linkTypeScript
1element.clear();

confirm(data)

Using this function to confirm payment intent.

Returns

Promiselink<>
linkTypeScript
1element.confirm({
2 client_secret: 'replace-with-your-client-secret',
3});
linkTypeScript
1element.createPaymentConsent({
2 client_secret: 'replace-with-your-client-secret',
3});

destroy()

Destroys the Element instance.

Returns

void
linkTypeScript
1element.destroy();

focus()

Using this function to focus the HTML Input element.

Returns

void
linkTypeScript
1element.focus();

mount(domElement)

Mounts Element to your HTML DOM.

Parameters

domElementrequiredstring | HTMLElement

Returns

null | HTMLElement
linkTypeScript
1// There are two ways to mount the element:
2// 1. Call with the container DOM id
3element.mount('container-dom-id');
4
5// 2. Find the created DOM in the existing HTML and call with the container DOM element
6const containerElement = document.getElementById('container-dom-id');
7element.mount(containerElement);

on(event, handler)

Listen to element event

Parameters

handlerrequiredEventListener

Returns

void
linkTypeScript
1element.on('change', () => {
2 // Handle change event
3});

unmount()

Unmounts the Element. Note that the Element instance will remain.

Returns

void
linkTypeScript
1element.unmount();

update(options?, initOptions?)

Using this function to update the element option after create the element.

Returns

void
linkTypeScript
1element.update({
2 placeholder: 'replace-with-your-placeholder',
3});