Promotions & Discount Codes
Time: ~10 minutes | Difficulty: Intermediate Use the Node SDK to define promotions (automatic or code-based discounts) with rules (when they apply) and actions (what they do). Attach human-readable promotion codes so customers can enter coupons at checkout.Promotions are scoped to a store (
storeId). Amounts in money fields are typically in the smallest currency unit (e.g. cents for USD) unless noted otherwise in your dashboard.Prerequisites
| Requirement | How to get it |
|---|---|
| Node.js 18+ | nodejs.org |
@tagadapay/node-sdk | npm install @tagadapay/node-sdk |
| API key | Dashboard → Settings → API Keys |
| A store | Merchant Quick Start |
Initialize and (optional) create a target product
Line-item discounts often reference a product id. For a store-wide percentage off, you can skip this.Create a percentage order discount (20% off)
Apply a percentage to the whole order withOrderAdjustment and adjustmentType: 'percentage'.
automatic: true means the promotion can apply without a coupon when your rules (if any) are satisfied. Set automatic: false when you only want it to apply via a promotion code.Create a fixed line-item discount ($10 off a specific product)
UseLineItemAdjustment with adjustmentType: 'amount' and adjustmentAmount in the full currency object shape (not just { USD: 1000 }).
adjustmentAmount format: each currency key maps to { amount, rate, lock, date }. Use an ISO date string (or timestamp) for date as required by your environment. rate, lock, and date participate in currency conversion and locking behavior on the platform.Conditional promotion: free shipping over $30
CombineOrderAmountMinimum in rules with ShippingAdjustment in actions.
Create a promotion code (coupon)
Link a reusable code to an existing promotion. Customers enter the code at checkout; the promotion’s rules and actions then apply.List, retrieve, update, and delete promotions
List
Retrieve
storeId is required for a reliable lookup in multi-store accounts.
Update
Updates are wrapped in adata object alongside id.
Delete
Pass an array of ids andstoreId.
Some API responses nest the resource under
promotion or promotionCode. When creating resources, read result.id or result.promotion?.id depending on the payload shape.Promotion rules reference
| Rule type | Purpose |
|---|---|
ContainsProduct | Order must include specific product(s) / variant(s) |
OrderAmountMinimum | Subtotal (or qualifying amount) must meet a minimum, using currency objects |
OrderMinQuantity | Minimum total line-item quantity on the order |
OrderMaxQuantity | Maximum total line-item quantity on the order |
MaxProductQuantity | Cap quantity eligible for the discount per product |
PaymentIntegrationSelected | Restrict to orders using a specific processor / payment integration |
Promotion actions reference
| Action type | What it does | Common fields |
|---|---|---|
LineItemAdjustment | Discount specific lines | adjustmentType: 'percentage' | 'amount'; adjustmentPercentage or adjustmentAmount; optional targetProductId, targetVariantIds, maxQuantityDiscounted, appliesOnEachItem |
OrderAdjustment | Discount the whole order | adjustmentType: 'percentage' | 'amount'; adjustmentPercentage or order-level adjustmentAmount |
ShippingAdjustment | Change shipping charges | e.g. freeShipping: true |
CreateLineItem | Add a line item when the promotion fires | Product / variant / quantity configuration (per your store setup) |
SubscriptionLineItemFreeTrial | Apply a free trial on subscription line items | Trial duration / terms as supported by the platform |
SDK methods: tagada.promotions
| Method | Signature (conceptual) | Description |
|---|---|---|
create | promotions.create({ storeId, name, enabled, automatic, actions, rules, ... }) | Create a promotion |
list | promotions.list({ storeId }) | List promotions for a store |
retrieve | promotions.retrieve(id, storeId) | Get one promotion; storeId required |
update | promotions.update({ id, data: { storeId, name, ... } }) | Update fields inside data |
del | promotions.del(ids[], storeId) | Delete one or more promotions |
SDK methods: tagada.promotionCodes
| Method | Signature (conceptual) | Description |
|---|---|---|
create | promotionCodes.create({ promotionId, code, active }) | Create a coupon linked to a promotion |
list | promotionCodes.list() | List promotion codes |
update | promotionCodes.update({ ... }) | Update an existing code (e.g. deactivate) |
del | promotionCodes.del(ids[]) | Delete codes by id |
Currency amount shape
Whenever the API expects a currency map (e.g.adjustmentAmount, minimumAmount), use:
EUR, GBP, …) for multi-currency stores as needed.
Next steps
Merchant Quick Start
Store, product, funnel, and checkout session setup
Upsell & Downsell Funnel
Post-purchase offers and conditional funnel routing
Custom Checkout
Advanced checkout flows with the Node SDK
API Reference
Full REST API documentation
