Submitting an order for a private store

Learn how to submit an order for a private store.

Submitting an order to a private store may seem daunting initiallyat first, but it's a straightforward process once you understand the steps involved. Whether you're a seasoned shopper or new to private stores, this guide will walk you through everything you need to know to place your order smoothly and efficiently. From obtaining a limited access token to confirming your purchase, we've got you covered. Let's get started.

Prerequisite: A user with the role of a Private Store Manager in Global Commerce must enable Private Stores in Site Settings. For more information, see Private Stores under Configuring site settings in the Global Commerce Help.

The following information describes submitting an order to a public store, private store, or friends and family.

To submit an order for a private store:

Step 1: Get a limited access token

Before managing a private store, you must obtain a limited access token. This token is essential for authenticating your request to the Commerce API and ensuring secure communication. Follow the steps below to get your limited access token, which involves using your session token and API key secret.

To get a limited access token, send a POST /oauth20/token?grant_type=password&sessionToken={session_token} request. Include the grant_type and sessionToken query parameters in the URI. Replace {session_token} with your credentials. Include your confidential key in the authentication header.

Example:

curl --location --request POST 'https://api.digitalriver.com/oauth20/token?grant_type=password&sessionToken={session_token}' \
--header 'authorization: bearer {apikey_secret_authr}\
...

This command sends a POST request to the Digital River API's token endpoint, asking for a token using the password grant type, which requires a session token and authorization.

Step 2: Enable the private store

To enable a private store for your Digital River API implementation, you must configure the access method most suitable for your target audience. This step is crucial in determining how a shopper can access the pricing for a purchase plan. Here are the access methods you can choose from:

  • Email Address: Shoppers must use their email address to gain access.

  • Email Domain: Restricts access to email addresses with specific domains. A domain is the end of the email address, such as "digitalriver.com" in "jane.doe@digitalriver.com."

  • Email Invitation: Access through an invitation from an existing member. If the shopper places an order, the person who sent the invitation must approve it. A private store using this access method is called a "friends and family" plan.

  • Generic Identifier: Requires a combination of a name and a PIN for access. Private stores can have multiple names and PIN combinations to access the plan.

  • IP Address: Restricts access to certain IP addresses or ranges. The shopper must be on a network using a specific IP address or an IP address within a defined range.

  • Referral URL: Shoppers must click a specific link to access the private store.

  • Bypass Access Method: For a less restrictive approach, use this to bypass particular access rules. The enums for the bypassAccessRuleType are EmailAddress, EmailDomain, EmailInvitation, and IpAddress.

Choose the method that aligns with your privacy needs and customer convenience. After selecting the preferred method, integrate it with your API settings to activate the private store feature.

{
    "purchasePlanAuthorize": {
        "id": "126668174",
        "targetMarketId": "126690174",
        "emailAddress": "chiliu@digitalriver.com"
    }
}

If you view the session, you will see the extended attributes for marketID and purchasePlanID.

Step 3: Add a product to the cart

This section will guide you through adding a product to your shopping cart. This involves sending a POST request with the necessary product ID and quantity.

To add a product to the cart, send POST /shoppers/me/carts/active?productId={productId}&quantity={quantity} request. Replace {productId} and {quantity} with the actual product ID and quantity. Include your confidential key in the authentication header.

Example:

curl --location --request POST 'https://api.digitalriver.com/shoppers/me/carts/active?productId={productId&quantity=[quantity}' \
--header 'authorization: bearer {apikey_secret_authr}'
...

Once you've added a product to a cart, notice the discounts under pricing and the PURCHASEPLAN_INCENTIVE_TOTAL value under extended attributes in the response.

Step 4: Update the billing and shipping address

In this step, we update your order's billing and shipping addresses. Accurate address information ensures proper delivery and billing. Follow the instructions below to send a POST request to the specified endpoint with the relevant address details.

To update the billing and shipping address, you need to send a POST request to the /shoppers/me/carts/active.json endpoint. Include your confidential key in the authentication header. Replace the placeholder values with your actual billing and shipping information. This request updates the addresses for the active cart associated with your shopper's profile.

Example:

curl --location --request POST 'https://api.digitalriver.com/shoppers/me/carts/active.json' \
--header 'authorization: bearer {apikey_secret_authr}\
...
--data-raw '{
    "cart": {
        "billingAddress": {
            "firstName": "Anita",
            "lastName": "Liu",
            "emailAddress":"chiliu@digitalriver.com",
            "companyName": null,
            "line1": "10380 Bren Rd",
            "line2": null,
            "line3": null,
            "city": "Taipei",
            "countrySubdivision": "MN",
            "postalCode": "10682",
            "country": "US"
        },
        "shippingAddress": {
            "firstName": "Anita",
            "lastName": "Liu",
            "emailAddress":"chiliu@digitalriver.com",
            "companyName": null,
            "line1": "10380 Bren Rd",
            "line2": null,
            "line3": null,
            "city": "Taipei",
            "countrySubdivision": "MN",
            "postalCode": "10682",
            "country": "US"
        }
    }
}'

Step 5: Submit the cart

After updating your active cart with billing and shipping information, the final step is to submit your cart to finalize the purchase. This process will ensure that all the items in your cart, along with the specified addresses, are ready for processing and eventual shipping. The following section demonstrates how to construct this request properly.

After updating your active cart with billing and shipping information, the final step is to submit your cart to finalize the purchase. This process will ensure that all the items in your cart, along with the specified addresses, are ready for processing and eventual shipping

To submit the cart and complete the checkout process, send a POST /shoppers/me/carts/active/submit-cart.json request. Include your confidential key in the authentication header.

Example:

curl --location --request POST 'https://api.digitalriver.com/shoppers/me/carts/active/submit-cart.json' \
--header 'authorization: bearer {apikey_secret_authr}\
...

Last updated