Applying an offer

Learn how to apply an offer.

Applying an offer to a cart

Use the POST /v1/shoppers/me/carts/active?expand=all request to apply an offer to a cart by including the applied product offers (appliedProductOffers) object in the payload.

curl --location -g --request POST ' https://api.digitalriver.com/v1/shoppers/me/carts/active?expand=all' \
--header 'Authorization: Basic {{access_token}}' \
...
--data-raw '{
  "cart": {
    "lineItems": {
      "lineItem": [
        {
          "quantity": 1,
          "product": {
            "id": 5181808200
          }
        }
      ],
      "appliedProductOffers": {
        "offer": {
          "offerId": "882920011",
          "externalReferenceId": "unique-id",
          "customDescription": "Exclusive on our shop!!!"
        },
        "shippingOffer": {
          "offerId": "882920011",
          "externalReferenceId": "unique-id",
          "customDescription": "Exclusive on our shop!!!"
        }
      }
    },
    "appliedOrderOffers": {
      "offer": {
        "offerId": "100029992",
        "externalReferenceId": "unique-id",
        "customDescription": "Exclusive on our shop!!!"
      },
      "shippingOffer": {
        "offerId": "123111333",
        "externalReferenceId": "unique-id",
        "customDescription": "Exclusive on our shop!!!"
      }
    }
  }
}'

You will get a 200 OK response.

Triggering an offer by cart

Use the POST /v1/shoppers/me/carts/active request to trigger one or more product-level offers by cart.

The offer type must be "Promotional URL / External Triggered Offer".

curl --location -g --request POST 'https://api.digitalriver.com/v1/shoppers/me/carts/active' \
--header 'Authorization: Basic {{access_token}}' \
...
--data-raw '{
  "lineItems": {
    "lineItem": [
      {
        "id": "488822300023",
        "quantity": 1,
        "product": {
          "id": "5181808200"
        }
      }
    ],
    "appliedProductOffers": {
      "offer": {
        "offerId": "882920011",
        "externalReferenceId": "unique-id",
        "customDescription": "Exclusive on our shop!!!"
      },
      "shippingOffer": {
        "offerId": "882920011",
        "externalReferenceId": "unique-id",
        "customDescription": "Exclusive on our shop!!!"
      }
    }
  }
}'

Trigging an offer by line items

Use the POST /line-items API to trigger one or more product-level offers at the line item.

The offer type must be "Promotional URL / External Triggered Offer".

curl --location -g --request POST 'https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items' \
--header 'Authorization: Basic {{access_token}}' \
...
--data-raw '{
  "cart": {
    "lineItems": {
      "lineItem": [
        {
          "quantity": 1,
          "product": {
            "id": "5181808200"
          }
        }
      ],
      "appliedProductOffers": {
        "offer": {
          "offerId": "882920011",
          "externalReferenceId": "unique-id",
          "customDescription": "Exclusive on our shop!!!"
        },
        "shippingOffer": {
          "offerId": "882920011",
          "externalReferenceId": "unique-id",
          "customDescription": "Exclusive on our shop!!!"
        }
      }
    },
    "appliedOrderOffers": {
      "offer": {
        "offerId": "100029992",
        "externalReferenceId": "unique-id",
        "customDescription": "Exclusive on our shop!!!"
      },
      "shippingOffer": {
        "offerId": "123111333",
        "externalReferenceId": "unique-id",
        "customDescription": "Exclusive on our shop!!!"
      }
    }
  }
}'

For more information see API trigger offer source and API trigger offer query parameters.

Last updated