Web SDK API Reference

Mount Card Input

Syntax

window.NI.mountCardInput('mount-point', {
  style,
  apiKey,
  outletRef,
  onSuccess,
  onFail,
  onChangeValidStatus
});

Arguments

ArgumentOptionalDescription
mount-pointNoA valid DOM id where in the card input needs to get mounted.
styleYesA object with different parameters to configure the look and feel of the card input through CSS.
apiKeyNoThis is the apiKey which needs to be provided to be able to mount the card-input.
outletRefNoThis is the unique outlet reference thats been assigned which can be determined by they N-Genius portal.
onSuccessYesCallback function which will get triggered when card input has been successfully mounted.
languageYesAllows you to define the Language for the SDK.
Values accepted: "ar" or "en".
Default value: "en"
onFailYesCallback function which will get triggered when card input has failed to load with some error.
onChangeValidStatusYes

Callback function which will be triggered when the overall validity of user populated fields changes.

You may also use this callback as the trigger to display any inline input errors on a per-field or overall basis.

Dynamic currency conversion (DCC)

To offer Global Blue DCC on your card form, add these arguments to mountCardInput. They do nothing unless DCC is switched on for your outlet.

ArgumentOptionalDescription
dccEnabledYesSet to true to offer DCC. The two DCC callbacks are only called when it is true.
orderDetailsNo, when dccEnabled is trueThe order's amount, in minor units, and its currency. The rate is looked up for this amount.
orderActionYesPURCHASE or AUTH, the action your server sends. With AUTH, the DCC choice screen shows an authorisation disclaimer.
onTriggerDCCNo, when dccEnabled is trueCallback called with the offer when the card's currency is not the order's. Pass the offer to handleDCCFlow.
onCompleateDccYesCallback called with the customer's choice. The name is spelt this way in the SDK, so use it exactly.

Handle DCC Flow

Syntax

const { isDccSelected, globalBlueId } = await window.NI.handleDCCFlow({
  config: { mountId, orderAction },
  dccData
});

Arguments

ArgumentOptionalDescription
config.mountIdNoThe DOM ID of the container the DCC choice screen is shown in.
config.orderActionYesPURCHASE or AUTH, as in mountCardInput.
dccDataNoThe payload onTriggerDCC received, passed on unchanged.

The promise resolves when the customer chooses, with isDccSelected and, when the offer carried one, globalBlueId. The session generated next by generateSessionId carries the choice. For a worked example, see Using Global Blue DCC with the Web SDK.

Style Options

const style = {
  main: {} /* the style for the main wrapper div around the card input*/,
  base: {} /* this is the default styles that comes with it */,
  input: {} /* custom style options for the input fields */,
  invalid: {} /* custom input invalid styles */
};

Common Style Options

Styles options below are applicable for, base , input , invalid :

Style NameDescription
colorThis takes in a string value for color and supports all the valid values that CSS supports.
heightThis takes in a string value in pixels/em/rem and supports all the valid values that CSS supports.
borderStyleThis takes in a string value and supports all the valid values that CSS property border-style supports.
borderWidthThis takes in a string value in pixels/em/rem and supports all the valid values that CSS property border-width supports.
borderColorThis takes in a string value and supports all the valid values that CSS property border-color supports.
borderRadiusThis takes in a string value in pixels/em/rem and supports all the valid values that CSS property border-radius supports.
backgroundColorThis takes in a string value and supports all the valid values that CSS property background-color supports.
fontUrlExample: https://fonts.googleapis.com/css?family=Cinzel&display=swap
fontFamilyExample: Cinzel
fontSizeThis takes in a string value and supports all the valid values that CSS property font-size supports.
fontWeightThis takes in a string value and supports all the valid values that CSS property font-weight supports.
paddingThis takes in a string value and supports all the valid values that CSS property padding supports.

The following css options applicable for main property:

Style NameDescription
marginThis takes in a string value and supports all the valid values that CSS property margin supports.
marginLeftThis takes in a string value and supports all the valid values that CSS property margin-left supports.
marginRightThis takes in a string value and supports all the valid values that CSS property margin-right supports.
topThis takes in a string value and supports all the valid values that CSS property top supports.
bottomThis takes in a string value and supports all the valid values that CSS property bottom supports.
leftThis takes in a string value and supports all the valid values that CSS property left supports.
rightThis takes in a string value and supports all the valid values that CSS property right supports.
paddingThis takes in a string value and supports all the valid values that CSS property padding supports.
positionThis takes in a string value and supports all the valid values that CSS property position supports.
overflowThis takes in a string value and supports all the valid values that CSS property overflow supports.
heightThis takes in a string value and supports all the valid values that CSS property height supports.
widthThis takes in a string value and supports all the valid values that CSS property width supports.
maxHeightThis takes in a string value and supports all the valid values that CSS property max-height supports.
maxWidthThis takes in a string value and supports all the valid values that CSS property max-width supports.
minHeightThis takes in a string value and supports all the valid values that CSS property min-height supports.
minWidthThis takes in a string value and supports all the valid values that CSS property min-width supports.
colorThis takes in a string value and supports all the valid values that CSS property color supports.
backgroundThis takes in a string value and supports all the valid values that CSS property background supports.
backgroundImageThis takes in a string value and supports all the valid values that CSS property background-image supports.
borderStyleThis takes in a string value and supports all the valid values that CSS property border-style supports.
borderColorThis takes in a string value and supports all the valid values that CSS property border-color supports.
borderRightThis takes in a string value and supports all the valid values that CSS property border-right supports.
borderRadiusThis takes in a string value and supports all the valid values that CSS property border-radius supports.
boxSizingThis takes in a string value and supports all the valid values that CSS property box-sizing supports.
boxShadowThis takes in a string value and supports all the valid values that CSS property box-shadow supports.
zIndexThis takes in a string value and supports all the valid values that CSS property z-index supports.

Did this page help you?
© Network International LLC. All Rights Reserved.