---
title: Apply a promotion to a customer pricing plan
slug: reference/apply-a-promotion-to-a-customer-pricing-plan
docTags: 
createdAt: 2025-03-18T18:28:02.918Z
---

{
  "id": "W4_Ty3aGiSWBSSITwUNEe",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/payments/pricing/amberflo/customer-promotions",
    "servers": [
      {
        "url": "https://app.amberflo.io/payments/pricing/amberflo/customer-promotions"
      }
    ],
    "name": "Apply a promotion to a customer pricing plan",
    "description": "<p>Applies an existing account-level promotion to a specific customer's pricing plan.</p>\n<p>This links an existing promotion to a specific customer, applying the promotion's discount rules\nto that customer's billing according to the configured timing and conditions.</p>\n<p>Use this for customer-specific discount campaigns, loyalty program benefits, retention offers,\nor custom pricing arrangements where you want to apply existing promotions to targeted customers.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Customer promotion application configuration specifying which promotion to apply to which customer",
          "customType": "payment.pricing.customer.CustomerAppliedPromotion.in",
          "schema": [
            {
              "name": "id",
              "kind": "optional",
              "type": "string",
              "description": "The id of the specific instance in time where a promotion (with promotion Id) was applied to a customer (same promotion might be applied multiple times for the same customer).",
              "example": ""
            },
            {
              "name": "productId",
              "kind": "optional",
              "type": "string",
              "description": "Unique product id.",
              "example": ""
            },
            {
              "name": "customerId",
              "kind": "optional",
              "type": "string",
              "description": "Unique customer id.",
              "example": ""
            },
            {
              "name": "promotionId",
              "kind": "optional",
              "type": "string",
              "description": "Unique promotion id to define an applied promotion.",
              "example": ""
            },
            {
              "name": "appliedTimeInSeconds",
              "kind": "optional",
              "type": "integer<int64>",
              "description": "Deprecated. When a promotion is in use in a customer pricing plan.",
              "example": 0
            },
            {
              "name": "addedTimeInSeconds",
              "kind": "optional",
              "type": "integer<int64>",
              "description": "When a promotion has been added to a pricing plan.",
              "example": 0
            },
            {
              "name": "removedTimeInSeconds",
              "kind": "optional",
              "type": "integer<int64>",
              "description": "When a promotion has been removed from a customer pricing plan.",
              "example": 0
            },
            {
              "name": "relationId",
              "kind": "optional",
              "type": "string",
              "description": "The unique ID of the relationship between the customer and promotion.",
              "example": ""
            },
            {
              "name": "appliedTimeRange",
              "kind": "optional",
              "type": "object",
              "description": "When something is applied and removed with hourly granularity.",
              "modelRef": "#/components/schemas/payment.common.TimeRange.in",
              "customType": "payment.common.TimeRange.in",
              "schema": [
                {
                  "name": "startTimeInSeconds",
                  "kind": "optional",
                  "type": "integer<int64>",
                  "description": "Unix timestamp marking the beginning of the time range in seconds",
                  "example": 0
                },
                {
                  "name": "endTimeInSeconds",
                  "kind": "optional",
                  "type": "integer<int64>",
                  "description": "Unix timestamp marking the end of time range or null for open-ended ranges",
                  "example": 0
                }
              ]
            },
            {
              "name": "priority",
              "kind": "optional",
              "type": "number",
              "description": "How we rank promotions of the same type against each other.",
              "example": ""
            },
            {
              "name": "removalContext",
              "kind": "optional",
              "type": "map",
              "description": "Identifying metadata around who and why a promotion was removed.",
              "example": "",
              "customType": "map<string, string>",
              "schema": []
            },
            {
              "name": "commitmentId",
              "kind": "optional",
              "type": "string",
              "description": "Optional field, populated by internal processes.",
              "example": ""
            },
            {
              "name": "entityProductInvoices",
              "kind": "optional",
              "type": "array",
              "description": "List of invoices that this customer applied promotion was used on.",
              "modelRef": "#/components/schemas/payment.billing.detailed.EntityProductInvoice.in",
              "customType": "payment.billing.detailed.EntityProductInvoice.in[]",
              "schema": [
                {
                  "name": "invoiceUri",
                  "kind": "optional",
                  "type": "string",
                  "description": "URI string identifier referencing the specific product invoice associated with this entity payment.",
                  "example": ""
                },
                {
                  "name": "createdTimeInSeconds",
                  "kind": "optional",
                  "type": "integer<int64>",
                  "description": "Unix timestamp indicating when this entity payment record was created in the system.",
                  "example": 0
                },
                {
                  "name": "amount",
                  "kind": "optional",
                  "type": "number",
                  "description": "Monetary amount used to pay for the product invoice by this entity type.",
                  "example": ""
                },
                {
                  "name": "invoiceAmount",
                  "kind": "optional",
                  "type": "number",
                  "description": "Total invoice amount value for reference tracking in entity payment processing systems.",
                  "example": ""
                }
              ]
            },
            {
              "name": "amountLeftInCycle",
              "kind": "optional",
              "type": "number",
              "description": "Amount of promotion left in cycle.",
              "example": ""
            },
            {
              "name": "totalAmountLeft",
              "kind": "optional",
              "type": "number",
              "description": "Amount of promotion left in total.",
              "example": ""
            }
          ],
          "modelRef": "#/components/schemas/payment.pricing.customer.CustomerAppliedPromotion.in",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "X-API-KEY",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Promotion successfully applied to customer",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Customer promotion application record tracking when specific promotions were added, used, and removed from customer pricing plans.",
            "customType": "payment.pricing.customer.CustomerAppliedPromotion.out",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "description": "The id of the specific instance in time where a promotion (with promotion Id) was applied to a customer (same promotion might be applied multiple times for the same customer).",
                "example": ""
              },
              {
                "name": "productId",
                "kind": "optional",
                "type": "string",
                "description": "Unique product id.",
                "example": ""
              },
              {
                "name": "customerId",
                "kind": "optional",
                "type": "string",
                "description": "Unique customer id.",
                "example": ""
              },
              {
                "name": "promotionId",
                "kind": "optional",
                "type": "string",
                "description": "Unique promotion id to define an applied promotion.",
                "example": ""
              },
              {
                "name": "appliedTimeInSeconds",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Deprecated. When a promotion is in use in a customer pricing plan.",
                "example": 0
              },
              {
                "name": "addedTimeInSeconds",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "When a promotion has been added to a pricing plan.",
                "example": 0
              },
              {
                "name": "removedTimeInSeconds",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "When a promotion has been removed from a customer pricing plan.",
                "example": 0
              },
              {
                "name": "relationId",
                "kind": "optional",
                "type": "string",
                "description": "The unique ID of the relationship between the customer and promotion.",
                "example": ""
              },
              {
                "name": "appliedTimeRange",
                "kind": "optional",
                "type": "object",
                "description": "When something is applied and removed with hourly granularity.",
                "modelRef": "#/components/schemas/payment.common.TimeRange.in",
                "customType": "payment.common.TimeRange.in",
                "schema": [
                  {
                    "name": "startTimeInSeconds",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "Unix timestamp marking the beginning of the time range in seconds",
                    "example": 0
                  },
                  {
                    "name": "endTimeInSeconds",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "Unix timestamp marking the end of time range or null for open-ended ranges",
                    "example": 0
                  }
                ]
              },
              {
                "name": "priority",
                "kind": "optional",
                "type": "number",
                "description": "How we rank promotions of the same type against each other.",
                "example": ""
              },
              {
                "name": "removalContext",
                "kind": "optional",
                "type": "map",
                "description": "Identifying metadata around who and why a promotion was removed.",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "commitmentId",
                "kind": "optional",
                "type": "string",
                "description": "Optional field, populated by internal processes.",
                "example": ""
              },
              {
                "name": "entityProductInvoices",
                "kind": "optional",
                "type": "array",
                "description": "List of invoices that this customer applied promotion was used on.",
                "modelRef": "#/components/schemas/payment.billing.detailed.EntityProductInvoice.in",
                "customType": "payment.billing.detailed.EntityProductInvoice.in[]",
                "schema": [
                  {
                    "name": "invoiceUri",
                    "kind": "optional",
                    "type": "string",
                    "description": "URI string identifier referencing the specific product invoice associated with this entity payment.",
                    "example": ""
                  },
                  {
                    "name": "createdTimeInSeconds",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "Unix timestamp indicating when this entity payment record was created in the system.",
                    "example": 0
                  },
                  {
                    "name": "amount",
                    "kind": "optional",
                    "type": "number",
                    "description": "Monetary amount used to pay for the product invoice by this entity type.",
                    "example": ""
                  },
                  {
                    "name": "invoiceAmount",
                    "kind": "optional",
                    "type": "number",
                    "description": "Total invoice amount value for reference tracking in entity payment processing systems.",
                    "example": ""
                  }
                ]
              },
              {
                "name": "amountLeftInCycle",
                "kind": "optional",
                "type": "number",
                "description": "Amount of promotion left in cycle.",
                "example": ""
              },
              {
                "name": "totalAmountLeft",
                "kind": "optional",
                "type": "number",
                "description": "Amount of promotion left in total.",
                "example": ""
              }
            ],
            "modelRef": "#/components/schemas/payment.pricing.customer.CustomerAppliedPromotion.out",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad request - invalid promotion application",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "Forbidden - insufficient permissions",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Customer or promotion not found",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "409",
        "description": "Conflict - promotion conflicts with existing customer promotions",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "kZhdXFXojHnB1WCRXpdNX",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://app.amberflo.io/payments/pricing/amberflo/customer-promotions \\\n     --header 'accept: application/json'"
        },
        {
          "id": "idIdqodqQM0SnM33IDbeL",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/payments/pricing/amberflo/customer-promotions\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "xdPR0YyssvOEb_yc7QLxO",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/payments/pricing/amberflo/customer-promotions\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "f_JB8zDwigdkC1cO6bjy4",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/payments/pricing/amberflo/customer-promotions\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "kZhdXFXojHnB1WCRXpdNX"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Promotion successfully applied to customer\n{\n  \"id\": \"\",\n  \"productId\": \"\",\n  \"customerId\": \"\",\n  \"promotionId\": \"\",\n  \"appliedTimeInSeconds\": \"\",\n  \"addedTimeInSeconds\": \"\",\n  \"removedTimeInSeconds\": \"\",\n  \"relationId\": \"\",\n  \"appliedTimeRange\": {\n    \"startTimeInSeconds\": \"\",\n    \"endTimeInSeconds\": \"\"\n  },\n  \"priority\": 0,\n  \"removalContext\": \"\",\n  \"commitmentId\": \"\",\n  \"entityProductInvoices\": [\n    {\n      \"invoiceUri\": \"\",\n      \"createdTimeInSeconds\": \"\",\n      \"amount\": 0,\n      \"invoiceAmount\": 0\n    }\n  ],\n  \"amountLeftInCycle\": 0,\n  \"totalAmountLeft\": 0\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad request - invalid promotion application\n"
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// Forbidden - insufficient permissions\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Customer or promotion not found\n"
        },
        {
          "id": "response-4-409",
          "language": "409",
          "code": "// Conflict - promotion conflicts with existing customer promotions\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}