Using Promo Codes on the PUT Order Endpoint
How to attribute an order to a promo code redemption when submitting orders via the API
Using Promo Codes
Promo Codes Take Rewarding Precedence Over Affiliate Links
Example: Submitting an Order with a Promo Code
Using Promo Codes
To attribute an order to a promo code redemption, set the promo field to the exact code the customer entered at checkout — e.g. "promo": "SUMMER20". This is the literal code string, not an internal reference ID. Multiple codes on one order can be submitted as an array.
Codes are matched case-sensitively — submit them exactly as issued (e.g. SUMMER20, not summer20).
Before submitting orders with a given code, the code must already exist in Duel's system. Codes are registered per brand, either via self-serve import in the admin dashboard or by your Duel contact. If a code hasn't been registered with us, an order referencing it will not attribute — even if the payload is otherwise correctly formed.
Self-purchases don't earn commission. If the customer redeeming the code is the same person the code belongs to, the order is still recorded, but commission (and points) are withheld by design. This is expected behaviour, not an error.
Other reasons a redemption may not be rewarded, which may appear in reporting or exports:
| Reason | Meaning |
|---|---|
expiredCode |
The code was valid at some point but has since expired |
retractedCode |
The code was withdrawn after being issued |
selfReferral |
The redeemer is the code's owner (see above) |
Promo Codes Take Rewarding Precedence Over Affiliate Links
If an order carries both promo and affiliate: the promo code always wins.
When a promo code is associated with a referral rule and an affiliate link is also present on the same order, Duel attributes the sale to the code, not the link.
This is a fixed platform rule, not something brands can configure — plan code and link campaigns with that in mind, since a customer who both clicks a link and later enters a code will always attribute via the code if it exists in the system.
Example: Submitting an Order with a Promo Code
curl -X PUT https://api.duel.tech/v1/orders/4563 \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"order": "4563",
"customer_id": "34548",
"new_customer": true,
"date": "2026-07-21T00:00:00.000Z",
"total": 12.34,
"total_gross": 15.99,
"currency": "GBP",
"promo": "SUMMER20",
"email": "jonsmith@example.com",
"points": 100,
"instore": false
}'
promocarries the exact code the customer entered, and must match what's registered in Duel.affiliateis omitted here since this order came via a promo code, not a referral link. Only include the field(s) that actually apply to the order.commissionis optional and only needed if you want to override Duel's calculated commission for this order. Omit it to let Duel calculate commission from your standard rules. It's left out of this example for that reason.PUT /v1/orders/{order_id}is an upsert: call it whether or not the order already exists in Duel. It creates the order if it's new, or updates it if it already exists, so you don't need to track order state on your side or choose between separate create/update calls.- Authentication uses a bearer token issued to your integration. Contact your Duel account team if you don't have one yet.