Skip to main content
The PromotionsService class (accessed via client.promotions) handles active store discounts, marketing campaigns, and coupon validation logic. Promotions support an image field (the default/desktop banner) plus an optional image_mobile field for a phone-sized banner — render image_mobile on small screens and fall back to image everywhere else.
A merchant’s promotions can also be advertised automatically. When Google Ads or Meta Ads is connected, Galactic Core can generate a campaign that features a running promotion’s real discount — timed to its window — and launch it when the promo goes live and pause it when it ends. This is a merchant-side capability configured in the admin, not an API call. See Advertising.
Never compute discounts yourself. Galactic Core calculates the exact discount for any cart server-side via calculatePromotionDiscount (one promotion) and calculateBestPromotion (pick the winner). The number you get back always matches what the merchant sees in their POS — so you never reimplement subtotal × percentage, bundle math, or BOGO logic on the storefront. See Calculating a discount below.

Methods

listPromotions

Retrieve a list of promotions based on their lifecycle status. This is useful for building a “Deals” or “Coupons” page on your storefront.
Response
Filter: cartTotal Providing a cartTotal allows the engine to pre-filter promotions that the customer is actually eligible for based on their current shopping bag value (compared against each promotion’s min_purchase).

getPromotion

Fetch full configuration data for a promotion, including its exact discount logic, validity dates, and the products it applies to.
Response

Getting the products in a promotion

The type field tells you how a promotion works and which product fields to read. The easy way — expand: 'products'. Pass expand: 'products' and Galactic Core resolves every product id in the promotion for you, embedding the product details inline. The response gains bundle_products_resolved, bogo_required_products_resolved, and bogo_free_products_resolved — same entries as the id arrays, but each carries a product object (or null if that product is unavailable). No second lookup:
Response
The manual way. Without expand, the product fields hold product ids — fetch each one’s full detail with client.products.getProduct(...) yourself:
For discount and fixed promotions there are no products to resolve — render value / min_purchase, and call calculatePromotionDiscount (below) to show the customer the exact amount they’ll save on their current cart.

Calculating a discount

Use calculatePromotionDiscount to compute exactly what a promotion takes off a given cart. The server does the math, so the figure you display always matches the merchant’s POS — you never multiply a subtotal by a percentage, sum bundle savings, or work out BOGO yourself. Send the cart you intend to charge. Each line is { product_id, quantity, price }, where price is the unit price you’re charging for that product:
The response is the same shape for every promotion type:
  • typediscount (percentage) and fixed are cart-wide discounts; bundle and bogo are computed from the products present in your cart.
  • When the cart doesn’t qualify, you get eligible: false, discount: 0, and a reason (minimum purchase not met, the promotion is outside its active date/time window, or required products are absent). Show the reason to nudge the shopper (e.g. “Add $30 more to unlock this deal”).
This is the right call for every type, including percentage and fixed — it’s how you turn “10% off” into a concrete dollar amount for the current cart.

Auto-applying the best promotion

calculateBestPromotion evaluates all of the store’s active promotions against a cart and returns the single one that saves the customer the most — ideal for auto-applying a deal at checkout without making the shopper hunt for a code:
When nothing applies, promotion is null and discount is 0:

Marketplace storefronts

When a sponsored ad placement or a curated collection hands you a promotion_id, pass the storeId you received alongside it (the merchant_store_id). It works the same way across all four calls here — getPromotion (including expand: 'products'), calculatePromotionDiscount, and calculateBestPromotion:
A marketplace key may read and calculate a single merchant’s promotions this way; it cannot list promotions.

Data Schema

Promotion Structure

PromotionCalculation (returned by calculatePromotionDiscount)

BestPromotion (returned by calculateBestPromotion)


Pro Marketing Tip: Use the image field to build high-impact promotional carousels. By associating visual assets directly with your discount logic, you can ensure that your marketing banners always reflect the current campaign status and validity.

Response Codes

Every method here accepts both publishable and secret keys, and calculatePromotionDiscount / calculateBestPromotion return 200 (they compute a result, they don’t create a resource). Marketplace keys may call getPromotion, calculatePromotionDiscount, and calculateBestPromotion (each with storeId) but not listPromotions. The status query parameter is validated against a strict enum.