Creating and updating checkouts

Learn the basics of how to create and update a Checkout

Setting Checkout attributes

For both create Checkout and update Checkout requests, the following table provides the available attributes, a description of each, and indicates whether the attribute is required or optional.

Attribute

Request type availability

Required/Optional

Description

customerId

Both

Optional

Refer to Using the customer identifier

sourceId

Both

Optional

Refer to Using the source identifier

currency

Both

Required in Create request

A three-letter alphabetic ISO currency code

email

Both

Optional

The email address of the customer.

locale

Both

Optional

Refer to Designating a locale

applicationId

Both

Optional

An arbitrary string identifier that can be used to track the application type. Unlike metadata, this value is searchable.

browserIp

Both

Optional

The IP address of the browser used by the customer when placing the order. If you do not provide the address, the effectiveness of the fraud prevention services that Digital River provides on the order are degraded.

shipFrom

Create

Optional

Refer to Providing address information

shipTo

Both

Optional

Refer to Providing address information

shippingChoice

Both

Optional

Refer to Specifying a shipping choice

discount

Create

Optional

Refer to Checkout level discount

items

Create

Required

Refer to Describing the items

shippingDiscount

Create

Optional

Refer to Shipping discount

taxInclusive

Create

Optional

Refer to Configuring taxes

chargeType

Both

Optional

Refer to Initiating a charge

customerType

Create

Optional

Refer to Using customerType

purchaseLocation

Both

Optional

Refer to Setting the purchase location

upstreamId

Both

Optional

Any identifier that you want to associate with the Checkout for tracking purposes. Unlike metadata, this value is searchable.

Example Checkout request and response

The following create Checkout request specifies all the required and most of the optional parameters contained in the resource:

cURL
cURL
curl --location --request POST 'https://api.digitalriver.com/checkouts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer API_KEY' \
--header 'Content-Type: text/plain' \
--data-raw '{
"currency": "USD",
"browserIp": "111.111.111.111",
"email": "jdoe@digitalriver.com",
"shipFrom": {
"address": {
"line1": "120 Vantis Drive",
"line2": "Suite 408",
"city": "Aliso Viejo",
"postalCode": "92656",
"state": "CA",
"country": "US"
}
},
"shipTo": {
"address": {
"line1": "10380 Bren Road West",
"city": "Minnetonka",
"postalCode": "55343",
"state": "MN",
"country": "US"
},
"name": "William Brown"
},
"shippingChoice": {
"amount": 5.95,
"description": "USPS: Priority (1 day delivery)",
"serviceLevel": "SG"
},
"items": [
{
"skuId": "11141976",
"price": 5.99
},
{
"skuId": "09062016",
"quantity": 2,
"price": 15.99
}
],
"chargeType": "customer_initiated",
"customerType": "individual",
"purchaseLocation": {
"country": "US",
"state": "MN",
"postalCode": "55364"
},
"upstreamId": "25092103-e116-4add-ba20-48187715ab26"
}'

A successful request returns the Checkout object:

JSON
JSON
{
"id": "176943940336",
"createdTime": "2020-05-07T21:30:23Z",
"currency": "USD",
"email": "jdoe@digitalriver.com",
"shipTo": {
"address": {
"line1": "10380 Bren Road West",
"city": "Minnetonka",
"postalCode": "55343",
"state": "MN",
"country": "US"
},
"name": "William Brown"
},
"shipFrom": {
"address": {
"line1": "120 Vantis Drive",
"line2": "Suite 408",
"city": "Aliso Viejo",
"postalCode": "92656",
"state": "CA",
"country": "US"
}
},
"totalAmount": 47.23,
"subtotal": 43.92,
"totalFees": 0.0,
"totalTax": 3.31,
"totalDuty": 0.0,
"totalDiscount": 0.0,
"totalShipping": 5.95,
"items": [
{
"skuId": "11141976",
"amount": 5.99,
"quantity": 1,
"tax": {
"rate": 0.07525,
"amount": 0.45
}
},
{
"skuId": "09062016",
"amount": 31.98,
"quantity": 2,
"tax": {
"rate": 0.07525,
"amount": 2.41
}
}
],
"shippingChoice": {
"amount": 5.95,
"description": "USPS: Priority (1 day delivery)",
"serviceLevel": "SG",
"taxAmount": 0.45
},
"upstreamId": "3c68812b-f178-474d-a831-4e2f06118fb5",
"browserIp": "111.111.111.111",
"locale": "en_US",
"purchaseLocation": {
"country": "US",
"state": "MN",
"postalCode": "55364"
},
"customerType": "individual",
"chargeType": "customer_initiated",
"paymentSessionId": "8545b424-02eb-4ddd-a631-d5ee1dc15e4e",
"sellingEntity": {
"id": "DR_INC-ENTITY",
"name": "Digital River Inc."
},
"liveMode": false
}