Creating a customer

Learn how to create a customer.

Creating a customer account enables shoppers to purchase when guest checkout is unavailable. This guide will help you understand how to create a customer account by leveraging the API key or access token to authenticate the request. Follow the steps below to successfully set up a new customer account for shoppers on your site.

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

To create a shopper, send a POST /v1/shoppers request with the customer's information in the request payload. This request requires either an access token or an API key.

If Digital River manages the customer login credentials, include username and password in the request body, with a base64 encoded password.

If your company manages the customer login credentials, include the externalReferenceId in the payload. If you do not specify an externalReferenceId, Digital River will assign a 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 whether Digital River or your company manages the customer login credentials. Here are the minimum required fields:

  • username

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

  • emailAddress

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

  • firstName

  • lastName

{
  "shopper": {
    "username": "jdoe@dr.com",
    "firstName": "Jane",
    "lastName": "Doe",
    "emailAddress": jdoe@dr.com,
    "password": "jdoepassword",
    "currency": "USD"    
    "locale": "en_US",
  }
}

The response from the server will be an HTTP Status 201 Created.

After creating the base customer record, you can obtain an authenticated customer token.

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