Creating and updating checkouts

Learn the basics of how to create and update a Checkout

The following sections provide details on how to set the parameters in create and update Checkout requests and provides an example of a successful request and response.

Setting checkout attributes

For both POST/checkouts and POST/checkouts/{id} requests, the following table provides the available parameters, whether they are available in a create or update request, and a description of each.

Parameter

Request type availability

Description

customerId

Both

Refer to Using the customer identifier

sourceId

Both

Refer to Using the source identifier

currency

Both

A three-letter alphabetic ISO currency code

email

Both

The email address of the customer.

locale

Both

Refer to Designating a locale

applicationId

Both

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

browserIp

Both

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

Both

Refer to Specifying ship from at the checkout-level and Specifying ship from at the item-level

shipTo

Both

Refer to Ship to address

shippingChoice

Both

Refer to Specifying a shipping choice

discount

Create

Refer to Checkout level discount

items

Both

Refer to Describing the items

shippingDiscount

Create

Refer to Shipping discount

taxInclusive

Create

Refer to Configuring taxes

chargeType

Both

Refer to Initiating a charge

customerType

Create

Refer to Using customerType

purchaseLocation

Both

Refer to Setting the purchase location

upstreamId

Both

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

Creating the checkout

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>' \
--data-raw '{
"customerId": 522317440336,
"currency": "USD",
"taxInclusive": false,
"browserIp": "111.111.111.111",
"chargeType": "customer_initiated",
"email": "null@digitalriver.com",
"shipTo": {
"address": {
"line1": "10380 Bren Road West",
"city": "Minnetonka",
"postalCode": "55343 9072",
"state": "MN",
"country": "US"
},
"name": "William Brown"
},
"shipFrom": {
"address": {
"line1": "350 S 5th St.",
"city": "Minneaplis",
"postalCode": "55415",
"state": "MN",
"country": "US"
}
},
"shippingChoice": {
"amount": 5.95,
"description": "USPS: Priority (1 day delivery)",
"serviceLevel": "SG"
},
"items": [
{
"skuId": "bc4aab24-2880-4de7-b6b0-07dd6e6841a9",
"price": 100.00,
"quantity": 2,
"subscriptionInfo": {
"terms": "terms",
"freeTrial": false
}
},
{
"skuId": "e446860d-86a6-4e22-ba38-bbaa2c17de55",
"price": 50.00,
"quantity": 3
}
]
}'

Create checkout response

A successful request returns a Checkout object.

Note that each element in the items array is returned with a unique id value. You'll need to use this value when modifying items during the checkout process, creating fulfillments, processing returns, and issuing refunds:

JSON
JSON
{
"id": "180636290336",
"createdTime": "2020-09-16T23:30:35Z",
"customerId": "522317440336",
"currency": "USD",
"email": "null@digitalriver.com",
"shipTo": {
"address": {
"line1": "10380 Bren Road West",
"city": "Minnetonka",
"postalCode": "55343 9072",
"state": "MN",
"country": "US"
},
"name": "William Brown"
},
"shipFrom": {
"address": {
"line1": "350 S 5th St.",
"city": "Minneaplis",
"postalCode": "55415",
"state": "MN",
"country": "US"
}
},
"totalAmount": 382.74,
"subtotal": 355.95,
"totalFees": 0.0,
"totalTax": 26.79,
"totalDuty": 0.0,
"totalDiscount": 0.0,
"totalShipping": 5.95,
"items": [
{
"id": "100442940336",
"skuId": "bc4aab24-2880-4de7-b6b0-07dd6e6841a9",
"amount": 200.0,
"quantity": 2,
"tax": {
"rate": 0.07525,
"amount": 15.05
},
"subscriptionInfo": {
"terms": "terms",
"autoRenewal": false,
"freeTrial": false
},
"availableToRefundAmount": 0.0
},
{
"id": "100442950336",
"skuId": "e446860d-86a6-4e22-ba38-bbaa2c17de55",
"amount": 150.0,
"quantity": 3,
"tax": {
"rate": 0.07525,
"amount": 11.29
},
"availableToRefundAmount": 0.0
}
],
"shippingChoice": {
"amount": 5.95,
"description": "USPS: Priority (1 day delivery)",
"serviceLevel": "SG",
"taxAmount": 0.45
},
"browserIp": "111.111.111.111",
"locale": "en_US",
"customerType": "individual",
"chargeType": "customer_initiated",
"paymentSessionId": "92c65e5b-fe0f-47a1-ae08-9fa681e17362",
"sellingEntity": {
"id": "C5_INC-ENTITY",
"name": "DR globalTech Inc."
},
"sourceId": "b422e538-5d42-4251-b8cb-142552ccf4a4",
"liveMode": false
}