WebElementGroup Methods

Update Method

Our SDK allows you to update certain configurations of the Web Elements Group. Just call the update method on the previously initialized WebElementsGroup and pass the the options that you want to update.

webElementsGroup.update(options);

Parameters

ParameterRequired/OptionalTypeDescription
optionsoptionalobjectUpdate Options

options

Parameter

Required/Optional

Type

Description

mode

optional

string

Options are "payment" or "setup".

currency

optional

string

The three-letter ISO currency code in lowercase. E.g. "usd".

amount

optional

decimal

This amount is shown in Apple Pay and Google Pay Payment Sheets when enabling digital wallets.

setupFutureUsage

optional

string

Options are "on_session" or"off_session". Indicates that the payment details will be saved for later use.

"on_session": The saved payment details will be used when the customer is present on the checkout page.

"off_session": The saved payment details will be used when the customer may or may not be present on the checkout page.

paymentMethodTypes

optional

array

Payment methods to be shown.

Options for the array are: "card" and "us_bank_account". If not provided or empty, it defaults to ["card","us_bank_account"].


Update Examples


// Assuming a Web Elements Group was created and saved in the webElementsGroup variable
// as done below on lines 4-9
const webElementGroup = gettrx.webElements({
  mode: 'payment',
  currency: 'usd',
  amount: 10.99,
  paymentMethodTypes: ['card','us_bank_account']
});
  
// To perform the update operation, just call the update Method on the variable where you 
// initialized the Web Elements group (e.g. webElementsGroup) 
webElementGroup.update({
  mode: 'setup',
  amount: 10.00,
  setupFutureUsage: "off_session"
});