Using the customer identifier

Learn how the checkout identifier can simplify Checkout creation

The optional customerId attribute represents the identifier of the Customer associated with the Checkout.

If you don't provide the identifier, then Digital River creates a checkout without a customerId.

If you do provide the identifier, we'll return basic information to you such as the customer's name, email, shipping address, and phone number.

When you create a Checkout using a customer identifier, but do not specify a sourceId , we use the customer's default payment source. For customer's with one or more attached payment Sources, we'll return the sourceId , thereby providing you a reference to the payment methods associated with that Customer object.

The information the customer provides on your storefront during the checkout process always overrides the data we retrieve from the Customer object. For example, at the time of checkout, if the customer enters a shipping address that differs from the one we retrieve from the Customer object, then the customer entered address takes precedence.

Example: Create a checkout for an existing customer

The following create new Checkout request only specifies the customerId, currency, and items parameters.

cURL
cURL
curl https://api.digitalriver.com/checkouts \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d customerId=987654321
-d currency=usd \
-d items[0][skuId]=09062016 \
-d items[0][price]=10.00 \
-d items[0][quantity]=2 \

The response, however, returns the data we inherit from the Customer object. That's because this example provides the customerId. As a result, you get back the customer's email address, shipping details, locale preference, and customerType. In this case, you also get the sourceId, which references the customer's default payment source.

If the Customer object has no payment Sources attached to it, then sourceId is not returned in the response.

{
"id": "176927530336",
"createdTime": "2020-05-07T19:02:22Z",
"customerId": "987654321",
"currency": "USD",
"email": "jdoe@digitalriver.com",
"shipTo": {
"address": {
"line1": "10380 Bren Rd W",
"line2": "string",
"city": "Minnetonka",
"postalCode": "55129",
"state": "MN",
"country": "US"
},
"name": "Jane Doe",
"phone": "952-111-1111",
"email": "jdoe@digitalriver.com",
"organization": "Digital River"
},
"totalAmount": 21.43,
"subtotal": 20.0,
"totalFees": 0.0,
"totalTax": 1.43,
"totalDuty": 0.0,
"totalDiscount": 0.0,
"totalShipping": 0.0,
"items": [
{
"skuId": "09062016",
"amount": 20.0,
"quantity": 2,
"tax": {
"rate": 0.07125,
"amount": 1.43
}
}
],
"locale": "de_DE",
"customerType": "individual",
"paymentSessionId": "e0b58261-31cf-4bd0-8118-162d7fb1e382",
"sellingEntity": {
"id": "DR_INC-ENTITY",
"name": "Digital River Inc."
},
"sourceId": "deabb3a4-14e4-4702-a13b-ddaac23277d3",
"liveMode": false
}