Creating a customer

Learn how to create a customer.

This topic describes how to create a customer account record. Creating a customer account is necessary for an anonymous customer when a site does not provide a guest checkout. In this instance, the site requires a customer to have an account before purchasing a product. Creating a customer is unnecessary for an anonymous customer only browsing products.

You can make this request without an access token by passing in your API key as a query parameter. You can also send this request with a valid anonymous or authenticated customer token.

Creating a shopper

Send a POST /v1/shoppers request with the customer's information in the request payload. The request requires an access token or an API key.

If Digital River maintains the master record for the customer login credentials, the request body must contain the username and password. The customer's password must be base64 encoded.

If your company maintains the master record for the customer login credentials, the payload must contain the externalReferenceId. When you create a customer without specifying an externalReferenceId, Digital River will assign a shopper identifier (shopperId).

Best Practices: Explicitly set the locale and currency for a customer at the start of a session.

curl --location --request POST 'https://api.digitalriver.com/v1/shoppers' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {{access_token}}' \
--header 'Cookie: {{token}}' \
--data-raw '{
  "shopper": {
    "username": "jdoe@dr.com",
    "firstName": "Jane",
    "lastName": "Doe",
    "emailAddress": jdoe@dr.com,
    "password": "jdoepassword",
    "currency": "USD"    
    "locale": "en_US",
  }
}'

Required payload contents

The required payload contents depend on who maintains the master record for the customer's username and password information. The base customer account information includes the customer's name and email address. The following list displays the minimum resource fields required for the Shoppers resource to create a customer record:

  • username

  • password (base64 encoded): Only required for a Digital River-hosted shopper. It is not required for a client-hosted shopper.

  • emailAddress

  • externalReferenceId: Only required for a client-hosted shopper.

  • firstName

  • lastName

The response returned from the server is an HTTP Status 201 Created.

You can get an authenticated customer token now that the base customer record has been created.

curl --location --request POST 'https://api.digitalriver.com/v1/shoppers' \
--header 'Authorization: bearer {{access_token}}' \ 
...

The following example passes in your API key instead of an access token:

curl --location --request POST 'https://api.digitalriver.com/v1/shoppers? apiKey=your_api_key' \ 
...

Last updated