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.

Send a POST /v1/shoppers request with the customer's information in the request payload.

The following example shows a request with an access token:

curl --location -g --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 -g --request POST 'https://api.digitalriver.com/v1/shoppers? apiKey=your_api_key' \ 
...

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)

  • emailAddress

  • externalReferenceId

  • firstName

  • lastName

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.

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

{
   "shopper": {
      "username": "[email protected]",
      "password": "cFGzc3dvcmQ=",
      "firstName": "John",
      "lastName": "Johnson",
      "emailAddress": "[email protected]",
      "locale": "en_US",
      "currency": "USD"
      "externalReferenceId": "external_reference_ID",
   }
}

If your company maintains the master record for the customer login credentials, the payload must contain the externalReferenceId.

{
   "shopper": {
      "username": "[email protected]",
      "password": "cFGzc3dvcmQ=",
      "firstName": "John",
      "lastName": "Johnson",
      "emailAddress": "[email protected]",
      "locale": "en_US",
      "currency": "USD"
      "externalReferenceId": "external_reference_ID",
   }
}

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

Now that the base customer record has been created, you can get an authenticated customer token and call the GET shoppers/me/account method to allow the customer to log in and configure their account information. The account information associated with a customer includes the shipping address, billing address, and payment options.

Last updated

Was this helpful?

#1249: DOC-395 CCAvenue

Change request updated