Adding custom fields
Learn how to add custom fields to a low-code checkout
Last updated
Learn how to add custom fields to a low-code checkout
Last updated
If you’d like to collect additional information from customers during a low-code checkout, you can add custom fields to the experience.
Digital River adds what these fields contain to the checkout-session so that you can use it in downstream processes.
On Digital River Dashboard’s Prebuilt Checkout page, you can configure a maximum of two custom fields, each of which can accept a number, text (i.e., string), or a set of pre-defined drop-down options.
For each field, you need to:
Indicate whether it’s required or optional.
If you mark it as required, then express checkout is disabled in Prebuilt Checkout.
Define a unique key and make sure it contains no whitespaces.
Define a label that will be displayed to customers in the experience.
If you’re using the drop-down field, you also need to enumerate acceptable values and provide a display label for each.
Depending on whether you add physical or digital-only products to the checkout-session’s items[]
Digital River renders your custom fields in the shipping or billing information forms, respectively.
Physical products in items[]
Digital only products in items[]
If you mark a field as required and customers don't provide a value, they are prompted for input.
Number-only fields provide help text if customers enter a non-digit character.
Number and text fields accept values with a maximum length of 500 characters.
Labels aren't translated into the language
of the checkout-session, but instead default to English.
The done()
function, which submits the data collected by the address component in an update checkout-session request, returns false
if the user (1) fails to enter a value in a custom field that you marked as required or (2) enters a value that exceeds 500 characters in a custom number or text field.
If your application is set up correctly, this should block customers from proceeding to the checkout's next stage.
For details, refer to Controlling the checkout flow.
If you mark a custom field as required in Dashboard, you might want to disable the wallet component. When users click a button in this component, they're redirected to a payment provider. However, the form in the provider's interface lacks a field to collect your custom data, and, as a result, it won't get added to the checkout-session.
After customers successfully submit the form, Digital River adds the key and value of each field they completed to the checkout-session’s metadata
.
You can access this data by:
Configuring a webhook to listen for certain types of events, such as checkout_session.order.created
, order.accepted
, fulfillment.created
, order.fulfilled
, and order.refunded
.
Assigning a callback to onCheckoutComplete
in Prebuilt Checkout's configuration object and then implementing a handler.
Assigning a callback to onSuccess
in the Component's configuration object and then implementing a handler.
Making a call to retrieve the order.
Once you have this metadata
, you can use it to populate email notifications, fulfill an order’s goods, or perform other operations of your choice.