Search…
Digital River payment objects
Learn how to use the Digital River payment objects.
An object is a collection of properties, and 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.
Billing address object
1
{
2
"name": "John Smith",
3
"firstName": "John",
4
"lastName": "Smith",
5
"phone": "952-555-1111",
6
"email": "[email protected]",
7
"address": {
8
"line1": "10380 Bren Rd W",
9
"line2": "string",
10
"city": "Minnetonka",
11
"postalCode": "55129",
12
"state": "MN",
13
"country": "US"
14
}
15
}
Copied!

Shipping address object

This object contains the customer's shipping address.
Shipping Address object
1
{
2
"name": "John Smith",
3
"firstName": "John",
4
"lastName": "Smith",
5
"phone": "952-555-1111",
6
"email": "[email protected]",
7
"address": {
8
"line1": "10380 Bren Rd W",
9
"line2": "string",
10
"city": "Minnetonka",
11
"postalCode": "55129",
12
"state": "MN",
13
"country": "US"
14
}
15
}
Copied!

Contact information object

This object contains the customer's contact information.
Contact Information object
1
{
2
"name": "John Smith",
3
"phone": "952-555-1111",
4
"email": "[email protected]"
5
}
Copied!

Payment request object

This object contains the payment request.
Payment Request object
1
var paymentRequestData = digitalriver.paymentRequest({
2
country: "US",
3
currency: "USD",
4
total: {
5
label: "Demo Total",
6
amount: 300
7
},
8
displayItems: [{
9
amount: 100,
10
label: "Item"
11
}, {
12
amount: 200,
13
label: "Better Item"
14
}],
15
shippingOptions: [{
16
id: "free-shipping",
17
label: "Free Shipping",
18
detail: "Arrives in 5 to 7 days",
19
amount: 0
20
}, {
21
id: "overnight-shipping",
22
label: "Overnight Shipping",
23
detail: "Arrives in 5 to 7 days",
24
amount: 1000
25
}],
26
requestShipping: true,
27
style: {
28
buttonType: "plain",
29
buttonColor: "light",
30
buttonLanguage: "en"
31
}
32
});
Copied!
Attribute
Required
Type
Description
country
Required
String
The country code for the Payment Request session.
currency
Required
String
The three-digit ISO currency code to supply to the Payment Request session. All amounts contained within the Payment Request will use this currency.
total
Required
The Payment Request total amount displayed to the customer as part of the Payment Request interface.
displayItems
Required
The Payment Request displays items to the customer as part of the Payment Request interface.
shippingOptions
Optional
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.
style
Optional
This attribute allows you to control the style of the button presented to the customer.

Payment request total item object

This object contains the payment request total.
Payment Request Total Item object
1
{
2
label: "Order Total",
3
amount: 100,
4
isPending: false
5
}
Copied!
Field
Required
Description
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.

Payment request style option object

This object contains the style information for the payment request.
Payment Request Style Option object
1
{
2
buttonType: "plain",
3
buttonColor: "light",
4
buttonLanguage: "en"
5
}
Copied!
Field
Required
Description
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.

Payment request display item object

This object contains the payment request information for the item.
Payment Request Display Item object
1
{
2
buttonType: "plain",
3
buttonColor: "light",
4
buttonLanguage: "en"
5
}
Copied!
Field
Required
Description
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.

Payment request shipping option object

This object contains the shipping option for the payment request.
Payment Request Shipping Option object
1
{
2
id: "overnight-shipping",
3
label: "Overnight Shipping",
4
amount: 10,
5
detail: "Will arrive tomorrow morning"
6
}
Copied!
Field
Required
Description
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.

Payment request details update object

Use this object to respond to a shipping address change or a shipping option change event sent from the Payment request session.
Field
Type
Required
Description
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.
error
Optional
These items will appears as the updated items in the Payment Request interface.
total
Optional
The new total amount, if applicable.
displayItems
Optional
These items will appears as the updated items in the Payment Request interface.
shippingOptions
Optional
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.
Successful Payment Request Details Update object
1
{
2
status: 'success',
3
error: {
4
},
5
total: {
6
label: "Order Total",
7
amount: 100,
8
isPending: false
9
},
10
displayItems: [
11
{
12
label: "Line Item Label (Product Name)",
13
amount: 100,
14
isPending: false
15
},
16
{
17
label: "Shipping Amount",
18
amount: 10,
19
isPending: false
20
},
21
],
22
shippingOptions: [
23
{
24
id: "standard-shipping",
25
label: "Standard Shipping",
26
amount: 0,
27
detail: "Will arrive in 7-10 days."
28
},
29
{
30
id: "overnight-shipping",
31
label: "Overnight Shipping",
32
amount: 10,
33
detail: "Will arrive tomorrow morning"
34
}
35
]
36
}
Copied!
Unsuccessful Payment Request Details Update object
1
{
2
status: 'failure',
3
error: {
4
message: 'We can only ship to the US, Canada and Mexico.'
5
}
6
}
Copied!
Unsucessful Payment Request Details Update Error object with errors
1
{
2
status: 'failure',
3
error: {
4
message: 'We can only ship to the US, Canada and Mexico.',
5
fields: {
6
addressLine: 'Your address is invalid.',
7
city: 'Your city is invalid.',
8
country: 'Your country is invalid',
9
phone: 'Your phone is invalid.',
10
postalCode: 'Your postal code is invalid.',
11
recipient: 'Your recipient value is invalid. Please supply a different one.',
12
region: 'Your region value is invalid. Please supply a different one.',
13
}
14
}
15
}
Copied!

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.
Payment Request Details Update Error object
1
{
2
message: "An Error has occurred. Please try again.",
3
fields: {
4
addressLine: 'Your address is invalid.',
5
city: 'Your city is invalid.',
6
country: 'Your country is invalid',
7
phone: 'Your phone is invalid.',
8
postalCode: 'Your postal code is invalid.',
9
recipient: 'Your recipient value is invalid. Please supply a different one.',
10
region: 'Your region value is invalid. Please supply a different one.',
11
}
12
}
Copied!

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.
Field
Payment Request Mapped Field
Required
addressLine
addressLine
Optional
city
city
Optional
state
region
Optional
postalCode
postalCode
Optional
country
country
Optional
recipient
recipient
Optional

Payment request response object

This object contains the response for the payment request.
Field
Type
Description
error
Boolean
source
The payment source created using the details provided by the payment session.
billingAddress
The billing address provided by the customer.
shippingAddress
The shipping address provided by the customer.
contactInformation
The contact information provided by the customer.
shippingOption
String
The customer's chosen shipping option.
complete
Function
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.

Payment request source object

This object contains the source object for the payment request.
Payment Request Source object
1
{
2
"error": false,
3
"source": {
4
"id": "5sdfd42a-1b02-471f-8c20-d9f7bb446d42",
5
"clientId": "gc",
6
"channelId": "drdod15",
7
"type": "creditCard",
8
"usage": "single",
9
"owner": {
10
"firstName": "firstName",
11
"lastName": "lastName",
12
"email": "[email protected]",
13
"referenceId": "testOrderID_payserv1",
14
"address": {
15
"line1": "1234 First St.",
16
"city": "Minnetonka",
17
"state": "MN",
18
"country": "US",
19
"postalCode": "55410"
20
}
21
},
22
"amount": "100.00",
23
"currency": "USD",
24
"status": "chargeable",
25
"creationIp": "67.216.237.4",
26
"creationDate": "2018-08-22T19:46:09.725Z",
27
"flow": "standard",
28
"creditCard": {
29
"brand": "Visa",
30
"expirationMonth": 12,
31
"expirationYear": 2025,
32
"lastFourDigits": "1111"
33
}
34
},
35
"billingAddress": {
36
"name": "John Smith",
37
"firstName": "John",
38
"lastName": "Smith",
39
"phone": "952-111-1111",
40
"email": "[email protected]"
41
"address": {
42
"line1": "10380 Bren Rd W",
43
"line2": "string",
44
"city": "Minnetonka",
45
"postalCode": "55129",
46
"state": "MN",
47
"country": "US"
48
}
49
},
50
"shippingAddress": {
51
"name": "John Smith",
52
"firstName": "John",
53
"lastName": "Smith",
54
"phone": "952-111-1111",
55
"email": "[email protected]"
56
"address": {
57
"line1": "10380 Bren Rd W",
58
"line2": "string",
59
"city": "Minnetonka",
60
"postalCode": "55129",
61
"state": "MN",
62
"country": "US"
63
}
64
},
65
"contactInformation": {
66
"name": "John Smith",
67
"phone": "952-111-1111",
68
"email": "[email protected]"
69
},
70
"shippingOption": {
71
id: "overnight-shipping",
72
label: "Overnight Shipping",
73
amount: 10,
74
detail: "Will arrive tomorrow morning"
75
},
76
complete: function() {
77
78
79
}
80
}
Copied!

Change event error object

Digital River returns this Error object returns with the change event when Digital River detects an error with an Element. This object contains a type, code, and message.
Change Event Error object
1
{
2
"type": "validation_error",
3
"code": "invalid_card_number",
4
"message": "Your card number is invalid."
5
}
Copied!

Create source error object

Digital River returns this Error object within the createSource method if Digital River detects an error with the tokenization request. This object contains a type and an array of messages that explain the error in detail.
Create Source Error object
1
{
2
"type": "bad_request",
3
"errors": [{
4
"code": "invalid_parameter",
5
"parameter": "owner.firstName",
6
"message": "'' is not a valid owner.firstname."
7
},
8
{
9
"code": "currency_unsupported",
10
"parameter": "currency",
11
"message": "currency 'xyz' is not supported."
12
}]
13
}
Copied!
Last modified 1yr ago