JavaScript SDK Configuration Properties
Basic Usage
This is the minimum configuration required, without any additional styling, callbacks, or field element placement in HTML markup.
window.Netvalve.initTokenFields({
formSelector: '#payment-form',
fields: {
cardNumber: {
containerSelector: '#card-number-container'
},
cardCvv: {
containerSelector: '#cvv-container'
},
cardExpiry: {
containerSelector: '#expiry-container'
}
}
});
Required Fields
formId
(string) ORformSelector
fields
(if<netvalve-cardnumber>
,<netvalve-cvv>
and<netvalve-expiry>
have not been placed in the HTML markup)
Allowed Properties and Methods
Property | Type | Required | Description | Format / Example |
---|---|---|---|---|
| string | Y* | Provide the form element id. |
|
| string | Y * |
|
|
| string | Y | The submit button element id |
|
| object | Y | A configuration object for each field. See Field Config below. | {
cardNumber: {},
cardCVV: {},
cardExpiry: {}
} |
| object | N | Object of css styles. Applies to all fields. Note: css properties are not camelcase. Example: use | {
'font-weight': 'bold'
} |
| object | N | Object of css styles. Applies to all field inputs. Note: css properties are not camelcase. Example: use | |
| object | N | Applies to all field input placeholders. Note css properties are not camelcase. Example: use | |
| string | N | The initial height of the iframe before the form’s input styles are calculated and applied to the form. Default is |
|
| boolean. Default = | N | By default the form will intercept the form submission, and if tokenization succeeds, it will either call the | true / false |
| function | N | The callback function invoked after all fields have been encrypted and the payment token ready. | |
| function | N | The callback function invoked for each field after validation occurs (success and fail). |
Field Configuration
This applies to the individual field objects under the fields
property, see above.
Property | Type | Required | Description | Format / Example |
---|---|---|---|---|
| string | Y* | A CSS selector for the div container where the field element will be rendered. |
|
| object | N | Object of css styles. Overrides the global/parent |
Example Advanced Implementation using callbacks