Create a Shopper

This topic describes how to create a shopper account record. Creating a shopper account is necessary for an anonymous shopper that does not yet have an account created for a site, and a site does not provide a guest checkout. In this instance, the site requires a shopper to have an account to purchase a product. Creating a shopper is not necessary for an anonymous shopper who is 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 either a valid limited or full access token. 

POST Requests

Send a POST shoppers request to the Shoppers API with the shopper's information in the request payload.

Request with an access token:

POST https://api.digitalriver.com/v1/shoppers/me HTTP/1.1

Request without an access token, passing in your API key:

POST https://api.digitalriver.com/v1/shoppers/me?apiKey=your_api_key HTTP/1.1

Request Body

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

  • username
  • password (base64 encoded) 
  • emailAddress
  • externalReferenceId
  • firstName
  • lastName

Digital River-maintained Shopper Login

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

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

1.  <shopper>
2.      <username>myShopper@myCompany.com</username>
3.      <password>cFGzc3dvcmQ=</password>
4.      <firstName>John</firstName>
5.      <lastName>Johnson</lastName>
6.      <emailAddress>jjohnson@myCompany.com</emailAddress>
7.      <locale>en_US</locale>
8.      <currency>USD</currency>
9.  </shopper>

Client-maintained Shopper Login

If the client (that is, customer) maintains the master record for the shopper login credentials, the request body must contain the externalReferenceId.

1.  <shopper>
2.     <firstName>John</firstName>
3.      <lastName>Johnson</lastName>
4.      <externalReferenceId>abc123</externalReferenceId>
5.      <emailAddress>jjohnson@myCompany.com</emailAddress>
6.      <locale>en_US</locale>
7.      <currency>USD</currency>
8.  </shopper>

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

Now that the base shopper record has been created, you can get a full access token and call the GET shoppers/me/account method to allow the shopper to log in and configure his or her account information. Additional account information associated with a shopper includes shipping address, billing address, and payment options.