Card field properties for direct merchants

DocsCurrentAdvancedLast updated: April 25th 2023, @ 4:16:45 pm


Important: This is version 2 of the card field properties guide for direct merchants.

The following card field properties are used to capture a payment. Use the render() method to render these instances to the DOM.

PropertyTypeField createdRequired
CVVFieldFunctionCard CVV or CID, a 3 or 4-digit codeYes
ExpiryFieldFunctionCard expiration dateYes
NameFieldFunctionName for the cardNo
NumberFieldFunctionCard numberYes

Card field options

Customize event callbacks or the style of each field with the following options:

PropertyTypeDescriptionRequired
inputEventsObject inputEventsAn object containing callbacks for when a specified input event occurs for a field.No
styleObject style guideStyle a field with supported CSS properties.No
placeholderStringEach card field has a default placeholder text. Pass a placeholder object to customize this text.No

Example

1const cardNameContainer = document.getElementById("card-name-field-container");
2const nameField = cardField.NameField({
3 placeholder: "Enter your full name as it appears on your card",
4inputEvents: {
5 onChange: (event)=> {
6 console.log("returns a stateObject", event);
7 }
8},
9style: {
10 ".invalid": {
11 "color": "purple",
12 }
13}
14});
15 });
16nameField.render(cardNameContainer);
17const cardNumberContainer = document.getElementById("card-number-field-container");
18const numberField = cardField.NumberField(/*options*/);
19numberField.render(cardNumberContainer);
20const cardExpiryContainer = document.getElementById("card-expiry-field-container");
21const expiryField = cardField.ExpiryField(/*options*/);
22expiryField.render(cardExpiryContainer);
23const cardCvvContainer = document.getElementById("card-cvv-field-container");
24const cvvField = cardField.CVVField(/*options*/);
25cvvField.render(cardCvvContainer);

See also