Learn how to use the Digital River payment objects.
An object is a collection of properties; a property is an association between a name (or key) and a value. DigitalRiver.js uses objects to collect data.
Billing address object
This object contains the customer's billing address.
{ status:'failure', error: { message:'We can only ship to the US, Canada and Mexico.' }}
{ status:'failure', error: { message:'We can only ship to the US, Canada and Mexico.', fields: { addressLine:'Your address is invalid.', city:'Your city is invalid.', country:'Your country is invalid', phone:'Your phone is invalid.', postalCode:'Your postal code is invalid.', recipient:'Your recipient value is invalid. Please supply a different one.', region:'Your region value is invalid. Please supply a different one.', } }}
Payment request details update error object
Use this object to display a specific error message to the customer as part of a Details Update message to the Payment Request session.
The Payment request details update error object is only available for Apple Pay.
{ message:"An Error has occurred. Please try again.", fields: { addressLine:'Your address is invalid.', city:'Your city is invalid.', country:'Your country is invalid', phone:'Your phone is invalid.', postalCode:'Your postal code is invalid.', recipient:'Your recipient value is invalid. Please supply a different one.', region:'Your region value is invalid. Please supply a different one.', }}
Details update error message
Use this optional string message to display a specific error message to your customer. This allows you to provide a better experience when correcting error scenarios.
Details update error fields
Use the following fields to display specific error information to the customer about what is wrong with their address Information.
Payment request response object
This object contains the response to the payment request.
Payment request source object
This object contains the source object for the payment request.
The Payment Request interface displays the Shipping Options field to the customer if you set the requestShipping parameter to true. The first item in the array is the default or selected shipping option.
requestShipping
Required
Boolean
If true, you must provide an array of shipping options from which the customer can choose.
This attribute allows you to control the style of the button presented to the customer.
label
Required
The label appears next to the Total Amount of the order on the Payment Sheet.
amount
Required
The amount of the Order displayed on the Payment Sheet.
isPending
Optional
If the Shipping Total, Tax Amount, or something similar is still pending, you can change this amount in the future. If you don't provide an updated value, the system treats this amount as Final.
buttonType
Optional
The type of button. If you don't specify a button type, the system uses the default button type.
buttonColor
Optional
The color of the button. If you don't specify a button color, the system uses the default color for the button.
buttonLanguage
Optional
The language for the button's label. If you don't specify a language, the DigitalRiver.js uses English by default.
label
Required
This label appears next to the Line Item of the order on the Payment Sheet.
amount
Required
This amount appears on the Payment Sheet for this Line Item.
isPending
Optional
If the Shipping Total, Tax Amount, or something similar is still pending, you can change this amount in the future. If you do not provide an updated value, the system treats this amount as Final.
id
Required
Once a customer selects a shipping option from the Payment Sheet, DigitalRiver.js returns the shipping option ID. This ID should correspond to something within your Order Management platform.
label
Required
The label appears as part of the Shipping Option on the Payment Sheet.
amount
Required
The amount that appears on the Payment Sheet for this Shipping Option.
detail
Required
A long description of the Shipping Option that appears on the Payment Sheet.
status
String
Required
Use this field to control the flow and error display within the Payment Request session. The values are as follows:
Success—Allows the Payment Request to proceed.
Failure—Prevents the change requested. Shows an error message.
The Payment Request interface displays the Shipping Options field to the customer if you set the requestShipping parameter to true. The first item in the array is the default or selected shipping option.
Call this function once you have processed the returned data. This function receives a string with the following values:
Success—Indicates the payment successfully processed. The user agent may or may not indicate success to the user. Use this value to dismiss the payment interface.
Failure—Indicates the payment failed to process. The user agent may or may not indicate the failure to the user.