LogoLogo
System status
Commerce API references
Commerce API references
  • Commerce API references
  • Warnings and error codes
    • Errors
    • Error codes
      • HTTP response status codes
      • Error format for Shopper APIs
      • Error codes for Shopper APIs
        • 400 Bad Request
        • 401 Unauthorized
        • 403 Forbidden
        • 404 Not Found
        • 405 Method Not Allowed
        • 409 Conflict
        • 412 Precondition Failed
        • 413 Payload Too Large
        • 500 Internal Server Error
      • Error format for Admin APIs
        • Async error objects
        • Sync error objects
        • Deployment objects
        • Warning objects
      • Error codes for Admin APIs
        • Error patterns
        • Supported image types
        • Asynchronous response error codes
        • Deployment error codes
        • Synchronous response error codes
  • Commerce API reference guide
    • API structure
      • API keys
      • Supported OAuth and Commerce API formats
      • Mini cart widget
      • Custom attributes
      • Fields used as keys
      • Fields and expand query parameters
      • Caching responses
      • CORS support
      • JSONP support
      • Transport
      • Service profiles
      • Supported protocols and formats
      • Elements
      • Rate limiting
      • Locale and currency
      • Exchange rate
      • Product identifier
      • Product external reference identifier (ERID)
      • Customer external reference identifier ERID
      • Cancel request process
      • Failover and redundancy
      • Troubleshooting API calls
    • Shopper APIs reference
      • Carts
        • Offers
          • Offer types
          • POP offers
          • Applied offers
          • Eligible offers
      • Orders
      • Returns
      • Links
    • Admin APIs reference
      • Subscriptions
      • Sites
      • Products
      • Live changes
      • Authorized shipping and billing countries
      • Merchandising
      • Disclosures
    • Glossary
Powered by GitBook
On this page
  • Best practices
  • Enabling the Enforce Unique Value
  • Admin APIs and ERID
  • Creating a product with an ERID
  • Shopper APIs and ERID
  • Retrieve specific products from the default catalog
  • Add a product to a shopping cart using the external reference identifier
  • Add a product by external reference identifier to the shopping cart and redirect to the storefront page
  1. Commerce API reference guide
  2. API structure

Product external reference identifier (ERID)

Understand the product ERID.

PreviousProduct identifierNextCustomer external reference identifier ERID

Last updated 2 months ago

Some companies have internal identifiers for their products. We call them external reference identifiers to distinguish them from our product identifiers. These external reference identifiers may or may not match the product identifier in Global Commerce.

You can use an external reference ID (ERID) to refer to either a or a .

Best practices

If you want to use the external reference identifier (ERID) when creating or updating a product or product variation, we recommend that you:

  • when configuring company settings in Global Commerce. When the Enforce Unique Value is enabled, duplicate ERIDs are not allowed. This ensures that you won't accidentally provide an ERID that would result in duplicate products in the response if you searched for a product by ERID.

  • Use the x-erid-as-pid=true in your HTTP requests when you provide an ERID. We use the value to identify the ID of the product as either a product identifier (productId) or an ERID. A false value indicates the product uses a product identifier. The value is false by default.

  • Use unique ERIDs for both the base product and its product variations. Don't mix ERIDs and product identifiers in a request.

Enabling the Enforce Unique Value

To enable the Enforce Unique Value:

  1. Sign in to Global Commerce.

  2. Select Administration, select Company, and then click Configure Company Settings. The Configure Company Settings page appears.

  3. Scroll to Product External Reference Number and select Yes next to Enforce Unique Value.

  4. Click Save.

Admin APIs and ERID

Creating a product with an ERID

An ERID request requires the x-erid-as-pid=true header. The following example creates a new base product with an ERID and product variations using an variationERID.

curl --location --request POST 'https://api.digitalriver.com/v1/products/{ERID}' \
--header 'Authorization: Bearer <API_key>' \
--header 'header x-erid-as-pid=true' \
...
--data-raw '{
    "productType": "BASE",  
    "companyId": "ace",  
    "liveChanges": 
        {  
            "externalReferenceId": "ERID_BASE"
        },  
    "variations": [    
        { 
            "productType": "VARIATION",      
            "companyId": "cast",      
            "varyingAttributes": [        
                {          
                    "attributeName": "Color",          
                    "attributeValue": "Black"        
                },        
                {          
                    "attributeName": "fulfillmentType",          
                    "attributeValue": "Download"        
                }      
            ],      
            "liveChanges": 
                { 
                    "externalReferenceId": "ERID_VARIATION_1"     
                }    
        },    
        {           
            "varyingAttributes": [        
                {          
                    "attributeName": "Color",          
                    "attributeValue": "Blue"        
                },        
                {          
                    "attributeName": "fulfillmentType",          
                    "attributeValue": "Download"        
                }      
            ],      
            "liveChanges":   
                { 
                    "externalReferenceId": "ERID_VARIATION_2"     
                }   
        }  
    ] 
}'

Shopper APIs and ERID

You can use an ERID to search for or add a product to a cart. The following examples demonstrate how you can use the externalReferenceId with the product-related resource.

Retrieve specific products from the default catalog

The following request gets products with an externalReferenceId of 30, 35, and 40.

curl --location --request GET 
'https://api.digitalriver.com/v1/shoppers/me/products?externalReferenceId=30,35,40' \
--header 'Authorization: Bearer <API_key>' \
...

Add a product to a shopping cart using the external reference identifier

Using the externalReferenceId query parameter, the following request example adds a product to a cart.

curl --location --request GET 
'https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items?externalReferenceId=0123456789' \
--header 'Authorization: Bearer <API_key>' \
...

If you do not provide a company identifier, The API uses the company identifier associated with the API key.

Add a product by external reference identifier to the shopping cart and redirect to the storefront page

 {
   "webCheckout": {
     "cart": {
       "lineItems": {
         "lineItem": {
           "quantity": "2",
           "product": {
             "externalReferenceId": "123456789"
            }
              ... more closing curly braces ...

A successful request with this particular API results in a 302 redirect to a Digital River-hosted guest checkout page.

The ERID variable can be one of the following values: an , , or identifier. You can use an ERID when creating a product or updating a product.

You must before you can use an ERID.

In a typical anonymous customer workflow, you can add products to a cart by external reference identifier, making a single POST call with a payload to the resource. The following payload (request entity) adds a product with the externalReferenceId of 123456789, with a quantity of 2, to a cart.

enable the Enforce Unique value
customer
product
Enable the Enforce Unique Value
individual
base
product variation
Web Checkout