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 customerCheckout

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.

CustomerCheckout

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.

curl --location --request POST 'https://api.digitalriver.com/checkouts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_key>' \
...
--data-raw '{
    "currency": "USD",
    "customerId": 531718920336,
    "taxInclusive": false,
    "shipFrom": {
        "address": {
            "country": "US"
        }
    },
    "shippingChoice": {
        "amount": 5,
        "description": "standard",
        "serviceLevel": "SG"
    },
    "items": [
        {
            "skuId": "25b3f1cf-a6d0-439a-b8e6-7e506452f717",
            "quantity": 2,
            "price": 10
        }
    ]
}'

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.

{
    "id": "531718920336",
    "createdTime": "2021-04-12T20:39:42Z",
    "email": "jdoe@digitalriver.com",
    "shipping": {
        "address": {
            "line1": "123 Boulevard",
            "city": "Saint Paul",
            "postalCode": "55155",
            "state": "MN",
            "country": "US"
        },
        "name": "John Doe",
        "phone": "555-555-5555"
    },
    "defaultSourceId": "5349c370-6694-45ff-915a-882e9b62b48d",
    "sources": [
        {
            "id": "5349c370-6694-45ff-915a-882e9b62b48d",
            "createdTime": "2021-04-12T20:40:26Z",
            "type": "creditCard",
            "reusable": true,
            "state": "chargeable",
            "owner": {
                "firstName": "William",
                "lastName": "Brown",
                "email": "null@digitalriver.com",
                "address": {
                    "line1": "10381 Bren Rd W",
                    "city": "Minnetonka",
                    "postalCode": "55343",
                    "state": "MN",
                    "country": "US"
                }
            },
            "clientSecret": "5349c370-6694-45ff-915a-882e9b62b48d_65525173-9ad9-4339-ba97-f889daf435c6",
            "creditCard": {
                "brand": "Visa",
                "expirationMonth": 7,
                "expirationYear": 2027,
                "lastFourDigits": "1111"
            }
        }
    ],
    "enabled": true,
    "requestToBeForgotten": false,
    "locale": "en_US",
    "type": "individual",
    "liveMode": false
}

Last updated