Performing actions
Gain a better understanding of how to perform customized actions in a Prebuilt Checkout
In Prebuilt Checkout, various callback functions can be assigned to properties in its configuration object. Some of these functions accept an optional actions
parameter, which allows you to:
Some callbacks in the checkout button configuration object also accept actions
. For details, refer to Performing actions on the checkout button.
Display custom order summary messages
You can use orderSummary
to render specific messages in the Prebuilt Checkout window.
orderSummary
orderSummary
The orderSummary
property in actions
allows you to specify whether you want a customized message to be displayed in the middle
and/or the bottom
of this section in Prebuilt Checkout.
You might find this useful if you'd like to, as an example, inform customers that the order summary amounts aren't final until they've selected a shipping option, provided applicable tax identification numbers, and applied the payment.
middle
middle
This property allows you to access the middle
of the window's orderSummary
section.
bottom
bottom
This property allows you to access the bottom
of the window's orderSummary
section.
addCustomMessage(message, showInfoIcon)
addCustomMessage(message, showInfoIcon)
This function displays a customized message in the middle
or bottom
of orderSummary
. It accepts an optional string representing the message you want displayed and an optional boolean, which determines whether Digital River displays an information icon next to your message.
The default value of showInfoIcon
is true
.
deleteCustomMessage()
deleteCustomMessage()
This function deletes any customized messages that exists in the middle
or bottom
of orderSummary
.
When onInit
executes, the following procedure loads your message in the middle of the order summary section.
After users successfully submit their address information and onAddressComplete
executes, the middle message is deleted, and a different message is added to the bottom.
Customize the order confirmation
You can use thankYouPage
to customize the order confirmation stage.
thankYouPage
thankYouPage
In actions
, the thankYouPage
property, which defines the order confirmation stage, exposes replaceDefaultMessage()
.
replaceDefaultMessage(message, showCheckCircleIcon)
replaceDefaultMessage(message, showCheckCircleIcon)
If you omit options.thankYouPage
, then you can use replaceDefaultMessage()
to modify the default order confirmation.
This function accepts a string, which represents the message you want displayed.
If you'd like the order's identifier injected into this message, add {{orderId}}
to the string. When the template renders, Digital River dynamically replaces this placeholder with the order's id
in our system or, in the event you passed upstreamId
in the create checkout-session request, that value.
The function also accepts an optional boolean that determines whether Digital River displays a circle check icon (a visual cue that the purchase was successful) prior to your customized message.
The default value of showCheckCircleIcon
is true
.
Invoke replaceDefaultMessage()
inside onInit
and make sure to pass checkoutSession
to this callback function.
Reject address inputs
The reject()
function, exposed by actions
, allows you to refuse shipping and billing inputs that you deem to be invalid.
reject()
reject()
If invoked in onAddressComplete
, then reject()
(1) blocks customers from proceeding to the checkout's next stage and (2) displays an error message to them.
It accepts an optional string representing the error message you'd like displayed. If you don't define this parameter, Digital River displays a default message.
You can use reject()
to screen out specific address categories. For example, with a regular expression and reject()
, you can prevent customers from shipping products to P.O. boxes.
Last updated