প্রোমো কোড এবং ডিসকাউন্ট বাস্তবায়ন, প্রোমো কোড এবং ডিসকাউন্ট বাস্তবায়ন

এই নির্দেশিকাটি ইউনিভার্সাল কমার্স প্রোটোকল (UCP)-এর 2026-01-23 সংস্করণে প্রচারমূলক কোড এবং ছাড় পরিচালনার জন্য প্রযুক্তিগত এপিআই রেফারেন্স এবং পেলোড স্কিমা প্রদান করে।

আপনার এন্ডপয়েন্টগুলো তৈরি করার আগে, উচ্চ-স্তরের ধারণা, গাণিতিক অপরিবর্তনীয়তা এবং ত্রুটি পরিচালনা বিধিগুলো জানার জন্য প্রোমো কোড ও ডিসকাউন্টের সংক্ষিপ্ত বিবরণটি পর্যালোচনা করে নিন।

আবিষ্কার

গুগল থেকে ডিসকাউন্ট কোড পেতে হলে, আপনাকে আপনার প্রোফাইলে ডিসকাউন্ট সাপোর্টের বিজ্ঞাপন দিতে হবে। 2026-01-23 সংস্করণে, ডিসকাউন্টের সুবিধাটি শুধুমাত্র চেকআউট সেশনের জন্য প্রযোজ্য।

{
  "ucp": {
    "version": "2026-01-23",
    "capabilities": {
      "dev.ucp.shopping.discount": [
        {
          "version": "2026-01-23",
          "extends": "dev.ucp.shopping.checkout",
          "spec": "https://ucp.dev/2026-01-23/specification/discount",
          "schema": "https://ucp.dev/2026-01-23/schemas/shopping/discount.json"
        }
      ]
    }
  }
}

লাইন আইটেম এবং মোট যোগফলের উপর প্রভাব

প্রয়োগকৃত ডিসকাউন্ট দুটি স্বতন্ত্র টোটাল টাইপ ব্যবহার করে মূল চেকআউট ফিল্ডগুলিতে প্রতিফলিত হয়। যদি কোনো allocations অ্যালোকেশন লাইন আইটেমকে নির্দেশ করে, তবে তা items_discount এ অন্তর্ভুক্ত হয়। অ্যালোকেশনবিহীন ডিসকাউন্ট, অথবা শিপিং বা ফি-কে অ্যালোকেশনযুক্ত ডিসকাউন্ট, discount এ অন্তর্ভুক্ত হয়।

ছাড়ের ধরণ মোট প্রকার যেখানে প্রতিফলিত
আইটেম-ভিত্তিক ছাড় items_discount line_items[].totals[type=items_discount]
অর্ডার-স্তরের ছাড় discount totals[type=discount]

সংস্করণের প্রয়োজনীয়তা:

2026-01-23 সংস্করণের জন্য, totals[] এবং line_items[].totals[] এর ভেতরের ডিসকাউন্টের পরিমাণ ধনাত্মক পূর্ণসংখ্যা হিসেবে দেখানো হয়েছে, যদিও এগুলো রসিদ থেকে একটি বিয়োগফল নির্দেশ করে। discounts.applied এবং allocations অ্যারের ভেতরের পরিমাণগুলোও ধনাত্মক পূর্ণসংখ্যাই থাকবে।

স্বয়ংক্রিয়ভাবে প্রয়োগ করা প্রচারের জন্য এপিআই উদাহরণ

নিম্নলিখিত উদাহরণগুলি স্বয়ংক্রিয়ভাবে প্রয়োগ করা ছাড় প্রদর্শন করে। অনুরোধ পেলোডগুলিতে ' discounts.codes ' অ্যারে থাকে না, কিন্তু প্রতিক্রিয়াগুলিতে "automatic": true অন্তর্ভুক্ত থাকে এবং code ফিল্ডটি বাদ দেওয়া হয়।

স্বয়ংক্রিয়ভাবে প্রয়োগ করা আইটেম-স্তরের ছাড়

একটি নির্দিষ্ট পণ্যের উপর সাইটজুড়ে ১০% ছাড় স্বয়ংক্রিয়ভাবে প্রয়োগ করা হয়েছে।

অনুরোধের উদাহরণ:

{
  "line_items": [
    {
      "id": "li_1",
      "item": { "title": "Sneakers", "price": 10000 },
      "quantity": 1
    }
  ]
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [
    {
      "id": "li_1",
      "item": { "title": "Sneakers", "price": 10000 },
      "quantity": 1,
      "totals": [
        {"type": "subtotal", "amount": 10000},
        {"type": "items_discount", "amount": 1000},
        {"type": "total", "amount": 9000}
      ]
    }
  ],
  "discounts": {
    "applied": [
      {
        "title": "10% Off Sitewide Sale",
        "amount": 1000,
        "automatic": true,
        "method": "each",
        "allocations": [
          {"path": "$.line_items[0]", "amount": 1000}
        ]
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 10000},
    {"type": "items_discount", "display_text": "Item Discounts", "amount": 1000},
    {"type": "total", "display_text": "Total", "amount": 9000}
  ]
}

স্বয়ংক্রিয়ভাবে প্রয়োগ করা অর্ডার-স্তরের ছাড়

একটি প্রচারমূলক নিয়ম (যেমন, "৫০ ডলারের বেশি অর্ডারে ১০ ডলার ছাড়") কোনো নির্দিষ্ট আইটেম আলাদাভাবে বরাদ্দ না করে সম্পূর্ণ অর্ডারের উপর প্রযোজ্য ছিল।

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ]
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "applied": [
      {
        "title": "$10 Off Orders Over $50",
        "amount": 1000,
        "automatic": true
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 6000},
    {"type": "discount", "display_text": "Order Promo", "amount": 1000},
    {"type": "total", "display_text": "Total", "amount": 5000}
  ]
}

ব্যবহারকারী-প্রয়োগকৃত পদোন্নতির জন্য এপিআই উদাহরণ

নিম্নলিখিত উদাহরণগুলি দেখায় যে একজন ব্যবহারকারী একটি প্রচারমূলক কোড প্রবেশ করানোর ফলে কী পরিমাণ ছাড় কার্যকর হয়। অনুরোধের পেলোডগুলিতে অনুরোধ করা কোডগুলি অন্তর্ভুক্ত থাকে এবং প্রতিক্রিয়াগুলি প্রয়োগকৃত পরিমাণ বরাদ্দ করার পাশাপাশি সেগুলিকে প্রতিধ্বনিত করে।

অর্ডার-স্তরের ছাড়

অর্ডারের মোট মূল্যের উপর একটি নির্দিষ্ট ছাড় প্রয়োগ করা হয়েছে। কোনো বরাদ্দের প্রয়োজন নেই; ছাড়টি সম্পূর্ণ অর্ডারের উপর প্রযোজ্য এবং type: "discount"

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SAVE10"]
  }
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SAVE10"],
    "applied": [
      {
        "code": "SAVE10",
        "title": "$10 Off Your Order",
        "amount": 1000
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 5000},
    {"type": "discount", "display_text": "Order Discount", "amount": 1000},
    {"type": "total", "display_text": "Total", "amount": 4000}
  ]
}

মিশ্র ছাড় (পণ্য + অর্ডার স্তর)

এই উদাহরণটিতে উভয় ধরণের ছাড় দেখানো হয়েছে: লাইন আইটেমগুলিতে বরাদ্দকৃত আইটেম-ভিত্তিক ছাড় (২০% ছাড়), এবং অর্ডার পর্যায়ে একটি স্বয়ংক্রিয় শিপিং ছাড়।

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SUMMER20"]
  }
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [
    {
      "id": "li_1",
      "item": { "title": "T-Shirt", "price": 2000 },
      "quantity": 2,
      "totals": [
        {"type": "subtotal", "amount": 4000},
        {"type": "items_discount", "amount": 800},
        {"type": "total", "amount": 3200}
      ]
    }
  ],
  "discounts": {
    "codes": ["SUMMER20"],
    "applied": [
      {
        "code": "SUMMER20",
        "title": "Summer Sale 20% Off",
        "amount": 800,
        "allocations": [
          {"path": "$.line_items[0]", "amount": 800}
        ]
      },
      {
        "title": "Free shipping on orders over $30",
        "amount": 599,
        "automatic": true
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 4000},
    {"type": "items_discount", "display_text": "Item Discounts", "amount": 800},
    {"type": "discount", "display_text": "Order Discounts", "amount": 599},
    {"type": "fulfillment", "display_text": "Shipping", "amount": 0},
    {"type": "total", "display_text": "Total", "amount": 2601}
  ]
}

প্রত্যাখ্যাত ডিসকাউন্ট কোড

যখন কোনো কোড অবৈধ হয়, তখন তা codes এ দেখানো হয় কিন্তু applied থেকে বাদ দেওয়া হয়। এই প্রত্যাখ্যানের বিষয়টি messages[] অ্যারেতে একটি warning মাধ্যমে জানানো হয়।

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SAVE10", "EXPIRED50"]
  }
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SAVE10", "EXPIRED50"],
    "applied": [
      {
        "code": "SAVE10",
        "title": "$10 Off Your Order",
        "amount": 1000
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 5000},
    {"type": "discount", "display_text": "Order Discount", "amount": 1000},
    {"type": "total", "display_text": "Total", "amount": 4000}
  ],
  "messages": [
    {
      "type": "warning",
      "code": "discount_code_expired",
      "path": "$.discounts.codes[1]",
      "content": "Code 'EXPIRED50' expired on December 1st"
    }
  ]
}

বরাদ্দের সাথে স্তূপীকৃত ছাড়

সম্পূর্ণ বরাদ্দের বিশদ বিবরণের সাথে একাধিক ছাড় প্রযোজ্য।

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SUMMER20", "EXTRA5"]
  }
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [
    {
      "id": "li_1",
      "item": { "title": "T-Shirt", "price": 6000 },
      "quantity": 1,
      "totals": [
        {"type": "subtotal", "amount": 6000},
        {"type": "items_discount", "amount": 1500},
        {"type": "total", "amount": 4500}
      ]
    },
    {
      "id": "li_2",
      "item": { "title": "Socks", "price": 4000 },
      "quantity": 1,
      "totals": [
        {"type": "subtotal", "amount": 4000},
        {"type": "items_discount", "amount": 1000},
        {"type": "total", "amount": 3000}
      ]
    }
  ],
  "discounts": {
    "codes": ["SUMMER20", "EXTRA5"],
    "applied": [
      {
        "code": "SUMMER20",
        "title": "Summer Sale 20% Off",
        "amount": 2000,
        "method": "each",
        "priority": 1,
        "allocations": [
          {"path": "$.line_items[0]", "amount": 1200},
          {"path": "$.line_items[1]", "amount": 800}
        ]
      },
      {
        "code": "EXTRA5",
        "title": "Extra $5 Off",
        "amount": 500,
        "method": "across",
        "priority": 2,
        "allocations": [
          {"path": "$.line_items[0]", "amount": 300},
          {"path": "$.line_items[1]", "amount": 200}
        ]
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 10000},
    {"type": "items_discount", "display_text": "Item Discounts", "amount": 2500},
    {"type": "total", "display_text": "Total", "amount": 7500}
  ]
}
,

এই নির্দেশিকাটি ইউনিভার্সাল কমার্স প্রোটোকল (UCP)-এর 2026-01-23 সংস্করণে প্রচারমূলক কোড এবং ছাড় পরিচালনার জন্য প্রযুক্তিগত এপিআই রেফারেন্স এবং পেলোড স্কিমা প্রদান করে।

আপনার এন্ডপয়েন্টগুলো তৈরি করার আগে, উচ্চ-স্তরের ধারণা, গাণিতিক অপরিবর্তনীয়তা এবং ত্রুটি পরিচালনা বিধিগুলো জানার জন্য প্রোমো কোড ও ডিসকাউন্টের সংক্ষিপ্ত বিবরণটি পর্যালোচনা করে নিন।

আবিষ্কার

গুগল থেকে ডিসকাউন্ট কোড পেতে হলে, আপনাকে আপনার প্রোফাইলে ডিসকাউন্ট সাপোর্টের বিজ্ঞাপন দিতে হবে। 2026-01-23 সংস্করণে, ডিসকাউন্টের সুবিধাটি শুধুমাত্র চেকআউট সেশনের জন্য প্রযোজ্য।

{
  "ucp": {
    "version": "2026-01-23",
    "capabilities": {
      "dev.ucp.shopping.discount": [
        {
          "version": "2026-01-23",
          "extends": "dev.ucp.shopping.checkout",
          "spec": "https://ucp.dev/2026-01-23/specification/discount",
          "schema": "https://ucp.dev/2026-01-23/schemas/shopping/discount.json"
        }
      ]
    }
  }
}

লাইন আইটেম এবং মোট যোগফলের উপর প্রভাব

প্রয়োগকৃত ডিসকাউন্ট দুটি স্বতন্ত্র টোটাল টাইপ ব্যবহার করে মূল চেকআউট ফিল্ডগুলিতে প্রতিফলিত হয়। যদি কোনো allocations অ্যালোকেশন লাইন আইটেমকে নির্দেশ করে, তবে তা items_discount এ অন্তর্ভুক্ত হয়। অ্যালোকেশনবিহীন ডিসকাউন্ট, অথবা শিপিং বা ফি-কে অ্যালোকেশনযুক্ত ডিসকাউন্ট, discount এ অন্তর্ভুক্ত হয়।

ছাড়ের ধরণ মোট প্রকার যেখানে প্রতিফলিত
আইটেম-ভিত্তিক ছাড় items_discount line_items[].totals[type=items_discount]
অর্ডার-স্তরের ছাড় discount totals[type=discount]

সংস্করণের প্রয়োজনীয়তা:

2026-01-23 সংস্করণের জন্য, totals[] এবং line_items[].totals[] এর ভেতরের ডিসকাউন্টের পরিমাণ ধনাত্মক পূর্ণসংখ্যা হিসেবে দেখানো হয়েছে, যদিও এগুলো রসিদ থেকে একটি বিয়োগফল নির্দেশ করে। discounts.applied এবং allocations অ্যারের ভেতরের পরিমাণগুলোও ধনাত্মক পূর্ণসংখ্যাই থাকবে।

স্বয়ংক্রিয়ভাবে প্রয়োগ করা প্রচারের জন্য এপিআই উদাহরণ

নিম্নলিখিত উদাহরণগুলি স্বয়ংক্রিয়ভাবে প্রয়োগ করা ছাড় প্রদর্শন করে। অনুরোধ পেলোডগুলিতে ' discounts.codes ' অ্যারে থাকে না, কিন্তু প্রতিক্রিয়াগুলিতে "automatic": true অন্তর্ভুক্ত থাকে এবং code ফিল্ডটি বাদ দেওয়া হয়।

স্বয়ংক্রিয়ভাবে প্রয়োগ করা আইটেম-স্তরের ছাড়

একটি নির্দিষ্ট পণ্যের উপর সাইটজুড়ে ১০% ছাড় স্বয়ংক্রিয়ভাবে প্রয়োগ করা হয়েছে।

অনুরোধের উদাহরণ:

{
  "line_items": [
    {
      "id": "li_1",
      "item": { "title": "Sneakers", "price": 10000 },
      "quantity": 1
    }
  ]
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [
    {
      "id": "li_1",
      "item": { "title": "Sneakers", "price": 10000 },
      "quantity": 1,
      "totals": [
        {"type": "subtotal", "amount": 10000},
        {"type": "items_discount", "amount": 1000},
        {"type": "total", "amount": 9000}
      ]
    }
  ],
  "discounts": {
    "applied": [
      {
        "title": "10% Off Sitewide Sale",
        "amount": 1000,
        "automatic": true,
        "method": "each",
        "allocations": [
          {"path": "$.line_items[0]", "amount": 1000}
        ]
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 10000},
    {"type": "items_discount", "display_text": "Item Discounts", "amount": 1000},
    {"type": "total", "display_text": "Total", "amount": 9000}
  ]
}

স্বয়ংক্রিয়ভাবে প্রয়োগ করা অর্ডার-স্তরের ছাড়

একটি প্রচারমূলক নিয়ম (যেমন, "৫০ ডলারের বেশি অর্ডারে ১০ ডলার ছাড়") কোনো নির্দিষ্ট আইটেম আলাদাভাবে বরাদ্দ না করে সম্পূর্ণ অর্ডারের উপর প্রযোজ্য ছিল।

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ]
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "applied": [
      {
        "title": "$10 Off Orders Over $50",
        "amount": 1000,
        "automatic": true
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 6000},
    {"type": "discount", "display_text": "Order Promo", "amount": 1000},
    {"type": "total", "display_text": "Total", "amount": 5000}
  ]
}

ব্যবহারকারী-প্রয়োগকৃত পদোন্নতির জন্য এপিআই উদাহরণ

নিম্নলিখিত উদাহরণগুলি দেখায় যে একজন ব্যবহারকারী একটি প্রচারমূলক কোড প্রবেশ করানোর ফলে কী পরিমাণ ছাড় কার্যকর হয়। অনুরোধের পেলোডগুলিতে অনুরোধ করা কোডগুলি অন্তর্ভুক্ত থাকে এবং প্রতিক্রিয়াগুলি প্রয়োগকৃত পরিমাণ বরাদ্দ করার পাশাপাশি সেগুলিকে প্রতিধ্বনিত করে।

অর্ডার-স্তরের ছাড়

অর্ডারের মোট মূল্যের উপর একটি নির্দিষ্ট ছাড় প্রয়োগ করা হয়েছে। কোনো বরাদ্দের প্রয়োজন নেই; ছাড়টি সম্পূর্ণ অর্ডারের উপর প্রযোজ্য এবং type: "discount"

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SAVE10"]
  }
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SAVE10"],
    "applied": [
      {
        "code": "SAVE10",
        "title": "$10 Off Your Order",
        "amount": 1000
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 5000},
    {"type": "discount", "display_text": "Order Discount", "amount": 1000},
    {"type": "total", "display_text": "Total", "amount": 4000}
  ]
}

মিশ্র ছাড় (পণ্য + অর্ডার স্তর)

এই উদাহরণটিতে উভয় ধরণের ছাড় দেখানো হয়েছে: লাইন আইটেমগুলিতে বরাদ্দকৃত আইটেম-ভিত্তিক ছাড় (২০% ছাড়), এবং অর্ডার পর্যায়ে একটি স্বয়ংক্রিয় শিপিং ছাড়।

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SUMMER20"]
  }
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [
    {
      "id": "li_1",
      "item": { "title": "T-Shirt", "price": 2000 },
      "quantity": 2,
      "totals": [
        {"type": "subtotal", "amount": 4000},
        {"type": "items_discount", "amount": 800},
        {"type": "total", "amount": 3200}
      ]
    }
  ],
  "discounts": {
    "codes": ["SUMMER20"],
    "applied": [
      {
        "code": "SUMMER20",
        "title": "Summer Sale 20% Off",
        "amount": 800,
        "allocations": [
          {"path": "$.line_items[0]", "amount": 800}
        ]
      },
      {
        "title": "Free shipping on orders over $30",
        "amount": 599,
        "automatic": true
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 4000},
    {"type": "items_discount", "display_text": "Item Discounts", "amount": 800},
    {"type": "discount", "display_text": "Order Discounts", "amount": 599},
    {"type": "fulfillment", "display_text": "Shipping", "amount": 0},
    {"type": "total", "display_text": "Total", "amount": 2601}
  ]
}

প্রত্যাখ্যাত ডিসকাউন্ট কোড

যখন কোনো কোড অবৈধ হয়, তখন তা codes এ দেখানো হয় কিন্তু applied থেকে বাদ দেওয়া হয়। এই প্রত্যাখ্যানের বিষয়টি messages[] অ্যারেতে একটি warning মাধ্যমে জানানো হয়।

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SAVE10", "EXPIRED50"]
  }
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SAVE10", "EXPIRED50"],
    "applied": [
      {
        "code": "SAVE10",
        "title": "$10 Off Your Order",
        "amount": 1000
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 5000},
    {"type": "discount", "display_text": "Order Discount", "amount": 1000},
    {"type": "total", "display_text": "Total", "amount": 4000}
  ],
  "messages": [
    {
      "type": "warning",
      "code": "discount_code_expired",
      "path": "$.discounts.codes[1]",
      "content": "Code 'EXPIRED50' expired on December 1st"
    }
  ]
}

বরাদ্দের সাথে স্তূপীকৃত ছাড়

সম্পূর্ণ বরাদ্দের বিশদ বিবরণের সাথে একাধিক ছাড় প্রযোজ্য।

অনুরোধের উদাহরণ:

{
  "line_items": [ ... ],
  "discounts": {
    "codes": ["SUMMER20", "EXTRA5"]
  }
}

প্রতিক্রিয়ার উদাহরণ:

{
  "line_items": [
    {
      "id": "li_1",
      "item": { "title": "T-Shirt", "price": 6000 },
      "quantity": 1,
      "totals": [
        {"type": "subtotal", "amount": 6000},
        {"type": "items_discount", "amount": 1500},
        {"type": "total", "amount": 4500}
      ]
    },
    {
      "id": "li_2",
      "item": { "title": "Socks", "price": 4000 },
      "quantity": 1,
      "totals": [
        {"type": "subtotal", "amount": 4000},
        {"type": "items_discount", "amount": 1000},
        {"type": "total", "amount": 3000}
      ]
    }
  ],
  "discounts": {
    "codes": ["SUMMER20", "EXTRA5"],
    "applied": [
      {
        "code": "SUMMER20",
        "title": "Summer Sale 20% Off",
        "amount": 2000,
        "method": "each",
        "priority": 1,
        "allocations": [
          {"path": "$.line_items[0]", "amount": 1200},
          {"path": "$.line_items[1]", "amount": 800}
        ]
      },
      {
        "code": "EXTRA5",
        "title": "Extra $5 Off",
        "amount": 500,
        "method": "across",
        "priority": 2,
        "allocations": [
          {"path": "$.line_items[0]", "amount": 300},
          {"path": "$.line_items[1]", "amount": 200}
        ]
      }
    ]
  },
  "totals": [
    {"type": "subtotal", "display_text": "Subtotal", "amount": 10000},
    {"type": "items_discount", "display_text": "Item Discounts", "amount": 2500},
    {"type": "total", "display_text": "Total", "amount": 7500}
  ]
}