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.

{
    "name": "John Smith",
    "firstName": "John",
    "lastName": "Smith",
    "phone": "952-555-1111",
    "email": "jsmith@digitalriver.com",
    "address": {
      "line1": "10380 Bren Rd W",
      "line2": "string",
      "city": "Minnetonka",
      "postalCode": "55129",
      "state": "MN",
      "country": "US"
    }
}

Shipping address object

This object contains the customer's shipping address.

{
    "name": "John Smith",
    "firstName": "John",
    "lastName": "Smith",
    "phone": "952-555-1111",
    "email": "jsmith@digitalriver.com",
    "address": {
      "line1": "10380 Bren Rd W",
      "line2": "string",
      "city": "Minnetonka",
      "postalCode": "55129",
      "state": "MN",
      "country": "US"
    }
}

Contact information object

This object contains the customer's contact information.

{
    "name": "John Smith",
    "phone": "952-555-1111",
    "email": "jsmith@digitalriver.com"
}

Payment request object

This object contains the payment request.

var paymentRequestData = digitalriver.paymentRequest({
    country: "US",
    currency: "USD",
    total: {
        label: "Demo Total",
        amount: 300
    },
    displayItems: [{
        amount: 100,
        label: "Item"
    }, {
        amount: 200,
        label: "Better Item"
    }],
    shippingOptions: [{
        id: "free-shipping",
        label: "Free Shipping",
        detail: "Arrives in 5 to 7 days",
        amount: 0
    }, {
        id: "overnight-shipping",
        label: "Overnight Shipping",
        detail: "Arrives in 5 to 7 days",
        amount: 1000
    }],
    requestShipping: true,
    style: {
        buttonType: "plain",
        buttonColor: "light",
        buttonLanguage: "en"
    }
});

Payment request total item object

This object contains the payment request total.

{
    label: "Order Total",
    amount: 100,
    isPending: false
}

Payment request style option object

This object contains the style information for the payment request.

{
        buttonType: "plain",
        buttonColor: "light",
        buttonLanguage: "en"
    }

Payment request display item object

This object contains the payment request information for the item.

{
        buttonType: "plain",
        buttonColor: "light",
        buttonLanguage: "en"
    }

Payment request shipping option object

This object contains the shipping option for the payment request.

{
    id: "overnight-shipping",
    label: "Overnight Shipping",
    amount: 10,
    detail: "Will arrive tomorrow morning"
}

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.

{
    status: 'success',
    error: {
    },
    total: {
        label: "Order Total",
        amount: 100,
        isPending: false
    },
    displayItems: [
        {
            label: "Line Item Label (Product Name)",
            amount: 100,
            isPending: false
        },
        {
            label: "Shipping Amount",
            amount: 10,
            isPending: false
        },
    ],
    shippingOptions: [
        {
            id: "standard-shipping",
            label: "Standard Shipping",
            amount: 0,
            detail: "Will arrive in 7-10 days."
        },
        {
            id: "overnight-shipping",
            label: "Overnight Shipping",
            amount: 10,
            detail: "Will arrive tomorrow morning"
        }
    ]
}
{
    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.

{
    "error": false,
    "source": {
        "id": "5sdfd42a-1b02-471f-8c20-d9f7bb446d42",
        "clientId": "gc",
        "channelId": "drdod15",
        "type": "creditCard",
        "usage": "single",
        "owner": {
            "firstName": "firstName",
            "lastName": "lastName",
            "email": "email@email.org",
            "referenceId": "testOrderID_payserv1",
            "address": {
                "line1": "1234 First St.",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55410"
            }
        },
        "amount": "100.00",
        "currency": "USD",
        "status": "chargeable",
        "creationIp": "67.216.237.4",
        "creationDate": "2018-08-22T19:46:09.725Z",
        "flow": "standard",
        "creditCard": {
            "brand": "Visa",
            "expirationMonth": 12,
            "expirationYear": 2025,
            "lastFourDigits": "1111"
        }
    },
    "billingAddress": {
        "name": "John Smith",
        "firstName": "John",
        "lastName": "Smith",
        "phone": "952-111-1111",
        "email": "jsmith@digitalriver.com"
        "address": {
            "line1": "10380 Bren Rd W",
            "line2": "string",
            "city": "Minnetonka",
            "postalCode": "55129",
            "state": "MN",
            "country": "US"
        }
    },
    "shippingAddress": {
        "name": "John Smith",
        "firstName": "John",
        "lastName": "Smith",
        "phone": "952-111-1111",
        "email": "jsmith@digitalriver.com"
        "address": {
            "line1": "10380 Bren Rd W",
            "line2": "string",
            "city": "Minnetonka",
            "postalCode": "55129",
            "state": "MN",
            "country": "US"
        }
    },
    "contactInformation": {
        "name": "John Smith",
        "phone": "952-111-1111",
        "email": "jsmith@digitalriver.com"
    },
    "shippingOption": {
        id: "overnight-shipping",
        label: "Overnight Shipping",
        amount: 10,
        detail: "Will arrive tomorrow morning"
    },
    complete: function() {
 
 
    }
}

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.

{
    "type": "validation_error",
    "code": "invalid_card_number",
    "message": "Your card number is invalid."
}

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 detailed messages explaining the error.

{
    "type": "bad_request",
    "errors": [{
           "code": "invalid_parameter",
           "parameter": "owner.firstName",
           "message": "'' is not a valid owner.firstname."
    },
    {
            "code": "currency_unsupported",
            "parameter": "currency",
            "message": "currency 'xyz' is not supported."
    }]
}

Last updated