Checking out guest and registered customers
Learn how to create guest and registered checkouts
A checkout's customerId references the customer making the purchase. You can pass this identifier in both create and update checkout requests.
For more information, refer to sequencing the checkout process on the Building checkouts page.
If you want to process a guest checkout, then don't set customerId. Conversely, if you want to process a registered checkout, then you should set customerId.

Guest checkouts

If you don't set a checkout's customerId, then no customer is associated with the purchase. So, when you want to checkout a guest, don't send customerId in the body of a POST/checkouts or POST/checkouts/{id} request.
In guest checkout scenarios, you'll need to acquire a customer's shipping address (assuming the cart contains physical products), billing address and email address. In addition, you must create one or more payment sources, and, when required, you'll also need to create a tax identifier.
Once you obtain these addresses and create these resources, you must associate their data with the checkout.
Guest customer
Text
Checkout
Shipping details
shipTo
Billing details
billTo
Email address
email
Tax identifiers
taxIdentifiers[]
Business or individual?
type
Payment method(s)
payment.sources[]
For more information refer to:

Registered checkouts

When checking out a registered customer, make sure you send customerId in the body of a POST/checkouts or POST/checkouts/{id} request. This associates the referenced customer with the checkout.
When developing registered checkout flows, you should be aware of (1) what attributes customers and checkouts have in common and (2) how customer data can be passed to the checkout.

Common attributes

Customers and checkouts have some common attributes. In registered checkouts, the following data in a customer can be passed to a checkout. The options that exist for passing this customer data to checkouts are version dependent.
Customer
Text
Checkout
shipping
shipTo
sources[].owner
billTo
sources[]
payment.sources[]
taxIdentifiers[]
taxIdentifiers[]
locale
locale
email
email
customerType
type
For more information refer to:

Passing customer data to checkouts

In registered checkouts, the Digital River APIs version you're using determines how customer data can be passed to checkouts:

Version 2021-12-13 and later

In versions 2021-12-13 and later, when you associate a customer with a checkout, Digital River doesn't, by default, pass that customer's data to the checkout. In other words, undefined common attributes in a checkout are not populated with the customer's data.
Instead, once registered customers have signed on to your site and you've obtained their unique identifier, you can make a GET/customers/{id} request to retrieve their shipping address, saved payment sources, billing addresses associated with those sources, tax identifiers, and other personal information.
At each stage of the checkout process, you can present this saved information to customers as an available option. Whether customers select the saved option presented to them or they use your site's forms to enter new information, you must pass this data to the checkout.
For example, when obtaining a ship to address in a checkout that contains physical products, you can get the customer's shipping, display it as an available option, and ask customers whether they want to use this saved address. Regardless of whether customers select the saved address or enter a new address, you must set the checkout's shipTo.

Version 2021-03-23 and earlier

In versions 2021-03-23 and earlier, when you associate a customer with a checkout, Digital River by default passes the customer's data to the checkout. In other words, any undefined common attribute in the checkout is automatically inherited from the associated customer.
The only exception is taxIdentifiers[]. Unless applicable to the transaction, we don't pass any of a customer's taxIdentifiers[] to the checkout. For more information, refer to using tax identifiers in registered checkouts on the Tax identifiers page.
Data you set in the checkout takes precedence over inherited customer data. Additionally, any data inherited by default from the customer can always be overwritten in subsequent update checkout requests.
For example, the following create checkout request contains a customerId but doesn't specify email, shipTo, billTo, locale, customerType, taxIdentifiers[] or sourceId.
POST/checkouts
1
curl --location --request POST 'https://api.digitalriver.com/checkouts' \
2
--header 'Content-Type: application/json' \
3
--header 'Authorization: Bearer <API_key>' \
4
...
5
--data-raw '{
6
"currency": "USD",
7
"customerId": 531718920336,
8
"taxInclusive": false,
9
"shipFrom": {
10
"address": {
11
"country": "US"
12
}
13
},
14
"shippingChoice": {
15
"amount": 5,
16
"description": "standard",
17
"serviceLevel": "SG"
18
},
19
"items": [
20
{
21
"skuId": "25b3f1cf-a6d0-439a-b8e6-7e506452f717",
22
"quantity": 2,
23
"price": 10
24
}
25
]
26
}'
Copied!
Once you submit this request, Digital River determines what common attributes, if any, are undefined in the checkout, whether the associated customer contains any of these undefined attributes, and, if it does, retrieves that data and sends it to the checkout.
In this particular example, Digital River uses the customer's email, shipping, defaultSourceId, locale, and type to set the corresponding checkout attributes. Note that the owner.address, owner.firstName, owner.lastName, and owner.email in the customer's default payment source are used to populate the checkout's billTo.
Customer
Checkout
1
{
2
"id": "531718920336",
3
"createdTime": "2021-04-12T20:39:42Z",
4
"email": "[email protected]",
5
"shipping": {
6
"address": {
7
"line1": "123 Boulevard",
8
"city": "Saint Paul",
9
"postalCode": "55155",
10
"state": "MN",
11
"country": "US"
12
},
13
"name": "John Doe",
14
"phone": "555-555-5555"
15
},
16
"defaultSourceId": "5349c370-6694-45ff-915a-882e9b62b48d",
17
"sources": [
18
{
19
"id": "5349c370-6694-45ff-915a-882e9b62b48d",
20
"createdTime": "2021-04-12T20:40:26Z",
21
"type": "creditCard",
22
"reusable": true,
23
"state": "chargeable",
24
"owner": {
25
"firstName": "William",
26
"lastName": "Brown",
27
"email": "[email protected]",
28
"address": {
29
"line1": "10381 Bren Rd W",
30
"city": "Minnetonka",
31
"postalCode": "55343",
32
"state": "MN",
33
"country": "US"
34
}
35
},
36
"clientSecret": "5349c370-6694-45ff-915a-882e9b62b48d_65525173-9ad9-4339-ba97-f889daf435c6",
37
"creditCard": {
38
"brand": "Visa",
39
"expirationMonth": 7,
40
"expirationYear": 2027,
41
"lastFourDigits": "1111"
42
}
43
}
44
],
45
"enabled": true,
46
"requestToBeForgotten": false,
47
"locale": "en_US",
48
"type": "individual",
49
"liveMode": false
50
}
Copied!
1
{
2
"id": "37a9569d-b23f-4d3e-b967-8dacb3427cc9",
3
"createdTime": "2021-04-12T20:43:18Z",
4
"customerId": "531718920336",
5
"currency": "USD",
6
"email": "[email protected]",
7
"shipTo": {
8
"address": {
9
"line1": "123 Boulevard",
10
"city": "Saint Paul",
11
"postalCode": "55155",
12
"state": "MN",
13
"country": "US"
14
},
15
"name": "John Doe",
16
"phone": "555-555-5555"
17
},
18
"shipFrom": {
19
"address": {
20
"country": "US"
21
}
22
},
23
"billTo": {
24
"address": {
25
"line1": "10381 Bren Rd W",
26
"city": "Minnetonka",
27
"postalCode": "55343",
28
"state": "MN",
29
"country": "US"
30
},
31
"name": "William Brown",
32
"email": "[email protected]"
33
},
34
"totalAmount": 26.97,
35
"subtotal": 25.0,
36
"totalFees": 0.0,
37
"totalTax": 1.97,
38
"totalImporterTax": 0.0,
39
"totalDuty": 0.0,
40
"totalDiscount": 0.0,
41
"totalShipping": 5.0,
42
"items": [
43
{
44
"id": "3a1fc426-87fb-4216-8619-2d29ac2d5818",
45
"skuId": "25b3f1cf-a6d0-439a-b8e6-7e506452f717",
46
"amount": 20.0,
47
"quantity": 2,
48
"tax": {
49
"rate": 0.07875,
50
"amount": 1.58
51
},
52
"importerTax": {
53
"amount": 0.0
54
},
55
"duties": {
56
"amount": 0.0
57
},
58
"fees": {
59
"amount": 0.0,
60
"taxAmount": 0.0
61
}
62
}
63
],
64
"shippingChoice": {
65
"amount": 5.0,
66
"description": "standard",
67
"serviceLevel": "SG",
68
"taxAmount": 0.39
69
},
70
"updatedTime": "2021-04-12T20:43:18Z",
71
"locale": "en_US",
72
"customerType": "individual",
73
"sellingEntity": {
74
"id": "C5_INC-ENTITY",
75
"name": "DR globalTech Inc."
76
},
77
"liveMode": false,
78
"payment": {
79
"sources": [
80
{
81
"id": "5349c370-6694-45ff-915a-882e9b62b48d",
82
"type": "creditCard",
83
"amount": 26.97,
84
"owner": {
85
"firstName": "William",
86
"lastName": "Brown",
87
"email": "[email protected]",
88
"address": {
89
"line1": "10381 Bren Rd W",
90
"city": "Minnetonka",
91
"postalCode": "55343",
92
"state": "MN",
93
"country": "US"
94
}
95
},
96
"creditCard": {
97
"brand": "Visa",
98
"expirationMonth": 7,
99
"expirationYear": 2027,
100
"lastFourDigits": "1111"
101
}
102
}
103
],
104
"session": {
105
"id": "55b44240-577c-4485-af5a-2c8224cb6653",
106
"amountContributed": 26.97,
107
"amountRemainingToBeContributed": 0.0,
108
"state": "requires_confirmation",
109
"clientSecret": "55b44240-577c-4485-af5a-2c8224cb6653_87c01674-8312-4f3a-afc7-7b2714fd47e8"
110
}
111
}
112
}
Copied!
Last modified 1mo ago