Skip to content

Card submit

Learn about customisation options for th card submit component.

Styling

const cardSubmitConfig: CardSubmitComponentConfig = {
  submitText: string,
  disableUntilValidated: boolean,
  hideSubmitButton: boolean,
  container: string,
  id: string,
  class: string,
  label: string,
  styles: CardSubmitComponentStyles,
  newCardComponent: NewCardComponent,
  cardNumberComponent: CardNumberComponent,
  cardExpiryDateComponent: CardExpiryDateComponent,
  cardCvcComponent: CardCvcComponent,
  cardHolderNameComponent: CardHolderNameComponent,
  cardConsentComponent: CardConsentComponent,
  cardOnFileComponent: CardOnFileComponent,
  clickOnceStandaloneComponent: ClickOnceStandaloneComponent,
  useCardOnFile: boolean,
  avsRequest: boolean,
  billingAddressComponents: {
    countrySelectionComponent: CountrySelectionComponent,
    postcodeComponent: PostcodeComponent,
    addressComponent: AddressComponent,
    billingAddressComponent: BillingAddressComponent
  },
  tabIndex: number,
  submitAriaLabel: string
};
PropertyDescription
submitTextThe text to display on the submit button.
disableUntilValidatedWhether to disable the submit button until all fields are validated.
hideSubmitButtonWhether to hide the submit button.
containerThe name of the HTML element to render the component into.
idThe unique identifier for the component.
classThe CSS class name for the component.
labelThe label text for the component.
stylesCustom styles for the component.
newCardComponentComponent for a new card. See New card.
cardNumberComponentComponent for the card number. See Card number.
cardExpiryDateComponentComponent for the card expiry date. See Card expiry date.
cardCvcComponentComponent for the CVC. See Card CVC.
cardHolderNameComponentComponent for the cardholder name. See Cardholder name.
cardConsentComponentConfiguration details for the card consent component.
cardOnFileComponentConfiguration details for the card-on-file component for saved payment methods.
clickOnceStandaloneComponentConfiguration for the click-once standalone component.
useCardOnFileWhether to select the card-on-file method to initiate the transaction. If true, uses COF data. If false, uses new card data. Defaults to false.
avsRequestWhether to enable AVS checks.
billingAddressComponentsConfiguration details for the billing address components. Allows you to integrate the pre-built billing address component with the card submit component.
If you pass billingAddressComponents and avsRequest is set to true, that will send billing address data to the transaction.
If you pass both the pre-built billingAddressComponent and the three standalone components, that will use pre-built billingAddressComponent's data.
billingAddressComponents.countrySelectionComponentComponent for country selection.
billingAddressComponents.postcodeComponentComponent for postcode input.
billingAddressComponents.addressComponentComponent for address input.
billingAddressComponents.billingAddressComponentConfiguration details for the billing address component. See Billing address.
tabIndexThe tab index of the component.
submitAriaLabelThe aria label for the submit button.

Callbacks

const cardSubmitConfig: CardSubmitComponentConfig = {
  onClick: (event: Event) => void,
  onChange: (state: ComponentState) => void,
  onValidation: (data: ValidationResult[]) => void,
  onPreTokenisation: () => boolean,
  onPostTokenisation: (data: CardTokenizationResult) => void,
  onPreInitiateAuthentication: () => PreInitiateIntegratedAuthenticationData | null | undefined,
  onPostInitiateAuthentication: (data: AuthenticationResult) => void,
  onPreAuthentication: (data: PreInitiateSuccessAuthenticationResult) => Promise<InitiateIntegratedAuthenticationData | null>,
  onPostAuthorisation: (submitResult: BaseSubmitResult) => void,
  onGetFingerprintResult: () => Promise<string>,
  onSubmitError: (baseSdkException: BaseSdkException) => void,
  onCollectStart: (data: any) => void,
  onCollectEnd: (data: any) => void
};
CallbackDescription
onClick: (event: Event) => voidEvent handler for when the submit button is clicked.
onChange: (state: ComponentState) => voidEvent handler for when the component state changes.
onValidation: (data: ValidationResult[]) => voidEvent handler for when validation occurs with validation results.
onPreTokenisation: () => booleanEvent handler for before tokenisation.
onPostTokenisation: (data: CardTokenizationResult) => voidEvent handler for after tokenisation completes with the tokenisation result.
`onPreInitiateAuthentication: () => PreInitiateIntegratedAuthenticationDatanull
onPostInitiateAuthentication: (data: AuthenticationResult) => voidEvent handler for after authentication initiation with the result.
`onPreAuthentication: (data: PreInitiateSuccessAuthenticationResult) => Promise<InitiateIntegratedAuthenticationDatanull>`
`onPostAuthentication: (data: AuthenticationResult, threeDSAuthenticationData: ThreeDSAuthenticationDatanull) => void`
`onPreAuthorisation: (data: PreAuthorizationDatanull, threeDSAuthenticationData: ThreeDSAuthenticationData
onPostAuthorisation: (submitResult: BaseSubmitResult) => voidEvent handler for after authorisation completes with the submit result.
onGetFingerprintResult: () => Promise<string>Retrieve fingerprint data for authentication.
onSubmitError: (baseSdkException: BaseSdkException) => voidEvent handler for when an error occurs during submission.
onCollectStart: (data: any) => voidEvent handler for when data collection begins.
onCollectEnd: (data: any) => voidEvent handler for when data collection ends.
onValidation: (data: ValidationResult[]) => voidEvent handler for when validation occurs with validation results.
onPreTokenisation: () => booleanEvent handler for before tokenisation.
onPostTokenisation: (data: CardTokenizationResult) => voidEvent handler for after tokenisation completes with the tokenisation result.
`onPreInitiateAuthentication: () => PreInitiateIntegratedAuthenticationDatanull
onPostInitiateAuthentication: (data: AuthenticationResult) => voidEvent handler for after authentication initiation with the result.
`onPreAuthentication: (data: PreInitiateSuccessAuthenticationResult) => Promise<InitiateIntegratedAuthenticationDatanull>`
`onPostAuthentication: (data: AuthenticationResult, threeDSAuthenticationData: ThreeDSAuthenticationDatanull) => void`
`onPreAuthorisation: (data: PreAuthorizationDatanull, threeDSAuthenticationData: ThreeDSAuthenticationData
onPostAuthorisation: (submitResult: BaseSubmitResult) => voidEvent handler for after authorisation completes with the submit result.
onGetFingerprintResult: () => Promise<string>Retrieve fingerprint data for authentication.
onSubmitError: (baseSdkException: BaseSdkException) => voidEvent handler for when an error occurs during submission.
onCollectStart: (data: any) => voidEvent handler for when data collection begins.
onCollectEnd: (data: any) => voidEvent handler for when data collection ends.

For more information about callbacks, see Events.

Example

const cardSubmitConfig: CardSubmitComponentConfig = {
  submitText: "Pay now",
  disableUntilValidated: true,
  avsRequest: true,
  cardNumberComponent: cardNumber,
  cardExpiryDateComponent: cardExpiry,
  cardCvcComponent: cardCvc,
  cardHolderNameComponent: cardHolderName,
  onClick: (event: Event) => {
    console.log('Submit button clicked', event);
    // Add custom logic before submission
    if (!userConsent) {
     event.preventDefault();
       showConsentDialog();
    }
  }
};