DigitalRiverCheckout configuration object
Learn about the functionality that exists within the DigitalRiverCheckout configuration object
The initialize DigitalRiverCheckout.js function accepts an optional configuration object, which allows you to define a local pricing selector.
Defining a local pricing selector
If you pair the local pricing service with a low-code checkout, you'll need to define countrySelector
.
countrySelector
countrySelector
The countrySelector
object allows you to:
containerId
containerId
The required containerId
represents the id
of an HTML element in which DigitalRiverCheckout.js should render the local pricing selector.
priceElement
priceElement
The optional priceElement
represents an array of CSS selector strings that DigitalRiverCheckout.js uses to target each element on your page that displays pricing information.
For example, span.price
in the following priceElement
targets all <span>
elements that have a class
attribute of "price"
.
When users modify currency or country in the selector, we make a call to determine whether Digital River supports that country, and it's set up for variable pricing. If this is the case, for each priceElement
, we apply a conversion factor and a rounding function, implement currency formatting rules, and display a converted, formatted value in its innerHTML
and add selected currency, selected country, converted price, formatted price, and original price attributes.
Local pricing selector events
In countrySelector
, you can assign callback methods to onReady
, onOpen
, onSelect
, onSave
, and onCancel
, which allows you to listen for various local pricing selector events and then define how you want to handle them.
onReady
onReady
The optional onReady
property can be assigned a callback method that executes when the local pricing selector is ready to accept user input.
When it executes, digitalRiverPricing
has been defined. For details, refer to Accessing country and currency.
onOpen
onOpen
The optional onOpen
property can be assigned a callback method that executes when the user clicks on the country-currency icon and the local pricing selector opens.
onSelect
onSelect
The optional onSelect
property can be assigned a callback method, which accepts data
, that executes when the user makes a selection in the local pricing selector. In data
, the method returns either country
or currency
, depending on which the user selected.
onSave
onSave
The optional onSave
property can be assigned a callback method, which accepts data
, that executes when the user clicks the local pricing selector's save button. In data
, the method returns the country
and currency
that the user saved.
onCancel
onCancel
The optional onCancel
property can be assigned a callback method that executes when the user clicks the local pricing selector's cancel button.
Last updated