Customers

Learn how to use the Customers resource.

The Customers endpoint allows you to present your customers with a list of orders they placed using your app or website. It allows you to associate a default shipping address with a customer and, by attaching payment sources to Customer objects, allows you to present your customers with a list of reusable payment methods that they previously used with your app or website.

Create a customer with a default shipping address like this:

cURL
curl https://api.digitalriver.com/customers \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d upstreamId="0916805858" \
-d email="jsmith@digitalriver.com" \
-d shipping[name]="John Smith" \
-d shipping[phone]="952-111-1111" \
-d shipping[email]="jsmith@digitalriver.com" \
-d shipping[address][line1]="10380 Bren Rd W" \
-d shipping[address][city]="Minnetonka" \
-d shipping[address][postalCode]="55129" \
-d shipping[address][state]="MN" \
-d shipping[address][country]="US"

A successful request returns the Customer object:

Response example
{
"id": 5823594809,
"createdTime": "2018-04-25T20:36:00Z",
"email": "jsmith@digitalriver.com",
"shipping": {
"address": {
"line1": "10380 Bren Rd W",
"line2": "string",
"city": "Minnetonka",
"postalCode": "55129",
"state": "MN",
"country": "US"
},
"name": "John Smith",
"phone": "952-111-1111",
"email": "jsmith@digitalriver.com"
}
}

Once you create a customer, you can then create checkouts for this customer like this:

cURL
curl https://api.digitalriver.com/checkouts \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d currency=usd \
-d email="jsmith@digitalriver.com" \
-d items[0][skuId]=sku_9234276173 \
-d items[0][price]=9.29 \
-d items[0][quantity]=2 \
-d shipping[name]="John Smith" \
-d shipping[phone]="952-111-1111" \
-d shipping[email]="jsmith@digitalriver.com" \
-d shipping[address][line1]="10380 Bren Rd W" \
-d shipping[address][city]="Minnetonka" \
-d shipping[address][postalCode]="55129" \
-d shipping[address][state]="MN" \
-d shipping[address][country]="US" \
-d customerId="5823594809" \
-d shippingChoice[amount]=5.95 \
-d shippingChoice[description]="USPS: Priority (1 day delivery)"
},

A successful request returns the Checkout object:

Response example
{
"id": "co_5823594809",
"createdTime": "2019-04-25T20:36:00Z",
"currency": "usd",
"email": "jsmith@digitalriver.com",
"customerId": "5823594809",
"shipping": {
"address": {
"line1": "10380 Bren Rd W",
"line2": "string",
"city": "Minnetonka",
"postalCode": "55129",
"state": "MN",
"country": "US"
},
"name": "John Smith",
"phone": "952-111-1111",
"email": "jsmith@digitalriver.com"
},
"totalTax": 1.40,
"totalFees": 0,
"totalDuty": 0,
"totalDiscount": 5.95,
"totalShipping": 0,
"totalAmount": 19.98,
"items": [
{
"skuId": "sku_9234276173",
"price": 9.29,
"quantity": 2,
"amount": 19.98
}
],
"shippingChoice": {
"amount": 5.95,
"description": "USPS: Priority (1 day delivery)"
},
"paymentSessionId": "ps_8cecaa32-f692-44cc-b103-4cf24dc93913",
"livemode": false
}