Offering local pricing
Gain a better understanding of how to set up local pricing for use in a Prebuilt Checkout
Last updated
Gain a better understanding of how to set up local pricing for use in a Prebuilt Checkout
Last updated
If you'd like to pair with , this page contains information on:
All of the local pricing functionality exists within .
When building your shopping experience, one possible solution is to wait until the document loads and then, at a minimum, define . Digital River needs this value to determine where to display the . Although it's not a hard requirement, you should also populate so we know which of your elements contain product prices.
You also have the option to define how you want to handle various . These events can be useful for testing, analytics, and triggering redirections. For example, you might handle by checking the value of country
, and then, if it's US
or CA
, redirect to a customized experience or store for shoppers in those countries.
If you're discounting an entire transaction or individual line items within that transaction, use discount.percentOff
or items[].discount.percentOff
. In both cases, don't define amountOff
.
If you don't want to build your formatter, many server-side languages have pre-built functions that roughly approximate the formatter Digital River uses. Depending on your application, you might find some of the following pages useful:
The following objects are nested in pricingFormat
:
currencyNumberFormat
You can use currencyNumberFormat
to determine how to display the integer and fractional parts of a price.
Its value indicates whether the character that groups digits in the integer part should be a comma (,
), a point (.
), an apostrophe ('
), a whitespace( ), or some other character. It also dictates the correct spacing of this character.
Additionally, currencyNumberFormat
allows you to determine whether the character that separates the price's integer part from its fractional part should be a point or a comma.
In the following example, currencyNumberFormat
groups the digits in the integer part with a comma placed every third digit to the left of a point, which acts as the separator between the price's integer and fractional parts.
Target output in UI
symbol
Use the graphic symbol
to denote the price's currency.
The following is the symbol
for Swiss Francs:
Target output in UI
decimalPlaces
This attribute stipulates the number of digits that should be displayed to the right of the character (whether it's a point or comma) that divides a price's integer part from its fractional part.
0
2
3
currencySymbolBeforePrice
true
false
useCurrencySymbolSpace
true
false
You can then use this to .
If you want Digital River to create a checkout button, call .
The function's is the element's id
where you want the button to display.
The is a configuration object that, among other things, allows you to (1) , (2) , and (3) .
This object also contains an property to assign an event-handling procedure. One way to define it is by using a block that first calls and then your own create checkout-session function. Make sure to use with this expression so that the handler pauses until a is returned.
On your front-end, in onClick
, call and then check the value of the promise. If it's , your procedure should reject it and halt execution. Otherwise, pass the returned identifier and, optionally, a to .
When defining the :
Call and and then assign the returned values to the and parameters, respectively.
For each product in the customer's cart, retrieve its original, unconverted price and assign it to .
On your server side, send a request and include your .
Digital River uses the shoppingCountry
, currency
, and items[].price
to perform another currency conversion, apply the same and rules used to display prices on your site. As a result, the currency-denominated prices customers see on your storefront and in your cart are identical to those in the checkout experience.
Once customers provide payment, complete their purchase, and Digital River converts the to an , we add pricingFormat
to the with a of .
This object contains Digital River's rules for formatting prices throughout the . To maintain a consistent format, you can apply these rules to the prices in your and your site's order management pages.
You can also access pricingFormat
by assigning a handler to .
If decimalPlaces
is 0
and indicates that a character should be placed between the integer and fractional parts, then that character shouldn't be displayed.
The currencySymbolBeforePrice
indicates whether should be placed before or after a price's numeric amount.
The useCurrencySymbolSpace
indicates whether or not to insert a space between and the price's numeric amount.