ClickOnceStandaloneComponentConfig

View the reference for the ClickOnceStandaloneComponentConfig file.

Reference

import ClickOnceComponentConfig from "@pxpio/web-components-sdk/src/components/clickOnceStandaloneComponents/types/ClickOnceStandaloneComponentConfig";

const clickOnceStandaloneConfig: ClickOnceStandaloneComponentConfig = {
  limitTokens: number,
  filterBy: {
    excludeExpiredTokens: boolean,
    schemes: string[],
    fundingSource: string,
    issuerCountryCode: string,
    ownerType: string
  },
  orderBy: {
    expiryDate: string,
    scheme: string,
    fundingSource: string,
    ownerType: string,
    issuerCountryCode: string,
    lastUsageDate: {
      orderByField: string
    }
  },
  cardBrandImages: {
    visaSrc: string,
    mastercardSrc: string,
    amexSrc: string,
    cupSrc: string,
    dinersSrc: string,
    discoverSrc: string,
    jcbSrc: string
  },
  isCvcRequired: boolean,
  cvcComponentConfig: CardCvcComponentConfig,
  hideCardBrandLogo: boolean,
  expiredText: string,
  validThruText: string,
  submitText: string,
  disableCardSelection: boolean,
  isRenderLastPurchaseCard: boolean,
  isRenderLastPayoutCard: boolean,
  isProcessNextStepOnCardClick: boolean,
  class: string,
  selectTokenItemClass: string,
  useTransparentCardBrandImage: boolean,
  selectCardButtonAriaLabel: string,
  label: string,
  labelAriaLabel: string,
  submitAriaLabel: string,
  cardNumberAriaLabel: string,
  cardExpiryDateAriaLabel: string,
  onOnceCardClick:() => void,
  buttonBuilder: (elementIds: ClickOnceButtonBuilderElementIds) => string,
  selectTokenItemBuilder: (elementIds: ClickOnceSelectTokenBuilderElementIds) => string,
  onPreRenderTokens: (data: RetrieveCardTokensReponseSuccess) => CardTokenMapping[]
}

const clickOnce = pxpCheckoutSdk.create("click-once-standalone");

Parameters

ParameterDescription
limitTokens
number
The maximum number of tokens to display in the component.
filterBy
object
Details about the filtering options.
filterBy.excludeExpiredTokens
boolean
Whether to exclude tokens associated with expired cards.
filterBy.schemes
string []
The list of card schemes to include. For example, [Visa, MasterCard].
filterBy.fundingSource
string
The funding source type to include. For example Credit or Debit.
filterBy.issuerCountryCode
string
The issuer country code to include.
filterBy.ownerType
string
The owner type to include.
orderBy
object
Details about the ordering options.
orderBy.expiryDate
object
Details for ordering by expiry date.
orderBy.expiryDate.direction
string
The direction to order by.

Possible values:
  • desc
  • asc
orderBy.expiryDate.priority
number
The priority of the ordering option.
orderBy.scheme
object
Details for ordering by card scheme.
orderBy.scheme.valuesOrder
string
The card scheme.
orderBy.scheme.priority
number
The priority of the ordering option.
orderBy.fundingSource
object
Details for ordering by funding source.
orderBy.fundingSource.valuesOrder
string
The funding source.

Possible values:
  • Credit
  • Debit
orderBy.fundingSource.priority
number
The priority of the ordering option.
orderBy.ownerType
object
Details for ordering by owner type.
orderBy.ownerType.valuesOrder
string
The owner type.

Possible values:
  • Consumer
  • Commercial
orderBy.ownerType.priority
number
The priority of the ordering option.
orderBy.issuerCountryCode
object
Details for ordering by issuer country code.
orderBy.issuerCountryCode.direction
string
The direction to order by.

Possible values:
  • desc
  • asc
orderBy.issuerCountryCode.priority
number
The priority of the ordering option.
orderBy.lastUsageDate
object
Details for ordering by last usage date.
orderBy.lastUsageDate.direction
string
The direction to order by.

Possible values:
  • desc
  • asc
orderBy.lastUsageDate.orderByField
string
The field to order by.

Possible values:
  • lastSuccessfulPurchaseDate
  • lastSuccessfulPayoutDate
orderBy.lastUsageDate.priority
number
The priority of the ordering option.
cardBrandImages
object
Details about the card brand images.
cardBrandImages.visaSrc
string
The URL for the Visa card brand image.
cardBrandImages.mastercardSrc
string
The URL for the Mastercard card brand image.
cardBrandImages.amexSrc
string
The URL for the Amex card brand image.
cardBrandImages.cupSrc
string
The URL for the CUP card brand image.
cardBrandImages.dinersSrc
string
The URL for the Diners card brand image.
cardBrandImages.discoverSrc
string
The URL for the Discover card brand image.
cardBrandImages.jcbSrc
string
The URL for the JCB card brand image.
isCvcRequired
boolean
Whether the CVC is required.
cvcComponentConfig
CardCvcComponentConfig
Configuration for the standalone card CVC component. See See reference for more details.
hideCardBrandLogo
boolean
Whether to hide the card brand logo.
expiredText
string
The text for the expired label.
validThruText
string
The text for the "valid thru" label.
submitText
string
The text for the submit label.
disableCardSelection
boolean
Whether to disable card selection.
isRenderLastPurchaseCard
boolean
Whether to render the last card that was used for a purchase.
isRenderLastPayoutCard
boolean
Whether to render the last card that was used for a payout.
isProcessNextStepOnCardClick
boolean
Whether to process the next step on card click.
class
string
The class name for the component.
selectTokenItemClass
string
The class name for the select token item in the select token list.
useTransparentCardBrandImage
boolean
Whether to use transparent card brand images. Defaults to true.
selectCardButtonAriaLabel
string
The aria label for the select card button.
label
string
The label for the click-once component.
labelAriaLabel
string
The aria label for the click-once component.
submitAriaLabel
string
The aria label for the submit button.
cardNumberAriaLabel
string
The aria label for the card number.
cardExpiryDateAriaLabel
string
The aria label for the card expiry date.

Callback

CallbackDescription
onOnceCardClick:() => voidCallback function triggered when a card is clicked.
buttonBuilder: (elementIds: ClickOnceButtonBuilderElementIds) => stringCallback function to build the token item layout.
selectTokenItemBuilder: (elementIds: ClickOnceSelectTokenBuilderElementIds) => stringCallback function to build the token labels.
onPreRenderTokens: (data: RetrieveCardTokensReponseSuccess) => CardTokenMapping[]Callback function to order/filter tokens before rendering.

Example

import ClickOnceComponentConfig from "@pxpio/web-components-sdk/src/components/clickOnceStandaloneComponents/types/ClickOnceStandaloneComponentConfig";

const clickOnceStandaloneConfig: ClickOnceStandaloneComponentConfig = {
  limitTokens: 5,
  filterBy: {
    excludeExpiredTokens: true,
    schemes: ["Visa", "MasterCard"],
    fundingSource: "Credit",
    issuerCountryCode: "USA",
    ownerType: "Consumer"
  },
  orderBy: {
    expiryDate: { 
      direction: "asc",
      priority: 1
    },
    scheme: { 
      valuesOrder: ["Visa", "MasterCard", "Amex"],
      priority: 2
    },
    fundingSource: { 
      valuesOrder: ["Credit", "Debit"],
      priority: 3
    },
    ownerType: { 
      valuesOrder: ["Consumer", "Commercial"],
      priority: 4
    },
    issuerCountryCode: { 
      direction: "desc",
      priority: 5
    },
    lastUsageDate: { 
      direction: "desc",
      orderByField: "lastSuccessfulPurchaseDate",
      priority: 6
    }
  },
  cardBrandImages: {
    visaSrc: "https://example.com/visa-logo.png",
    mastercardSrc: "https://example.com/mastercard-logo.png",
    amexSrc: "https://example.com/amex-logo.png"
  },
  cvcRequired: true,
  cvcComponentConfig: {
    required: true,
    label: "Security code",
    applyMask: true,
    showMaskToggle: true,
    labelPosition: "left",
    errorMessage: "Please enter a valid security code",
    inputStyles: {
    base: {
      color: "#333",
      fontSize: "16px"
    }
  },
  hideCardBrandLogo: false,
  expiredText: "Card expired",
  validThruText: "Valid until",
  submitText: "Pay now",
  disableCardSelection: false,
  isRenderLastPurchaseCard: true,
  isRenderLastPayoutCard: true,
  isProcessNextStepOnCardClick: true,
  class: "custom-class",
  selectTokenItemClass: "custom-select-token-item-class",
  useTransparentCardBrandImage: true,
  selectCardButtonAriaLabel: "Select card",
  label: "Click once to pay",
  labelAriaLabel: "Click once to pay",
  submitAriaLabel: "Submit",
  cardNumberAriaLabel: "Card number",
  cardExpiryDateAriaLabel: "Card expiry date",
  onOnceCardClick:() => console.log("Card clicked"),
  tokenItemBuilder: (config: ClickOnceButtonBuilderElementIds) => {
    return `<div>
      <div id="${config.tokenImageId}"></div>
      <div id="${config.tokenLabelId}"></div> 
      <div id="${config.cvcComponentId}"></div> 
      <div id="${config.payNowId}"></div> 
    </div>`
  },
  selectTokenItemBuilder: (elementIds: ClickOnceSelectTokenBuilderElementIds) => {
    return `<div>
      <div id="${elementIds.tokenImageId}"></div>
      <div id="${elementIds.cardNumberId}"></div>
      <div id="${elementIds.expiryDateId}"></div>
    </div>`
  }, 
  onPreRenderTokens: (data: RetrieveCardTokensReponseSuccess) => {
    return data.gatewayTokens.filter((token) => token.issuerCountryCode === 'USA').map((token) => ({id: token.gatewayTokenId, isCvcRequired: true}))
  },
  onPreRenderTokens?: (data: RetrieveCardTokensReponseSuccess) => CardTokenMapping[]
}
  
const clickOnceStandalone = pxpCheckoutSdk.create("click-once-standalone");