Reference
Create & Update Basket
This endpoint is used to notify Thanx of the states that a basket is in, apply rewards to the order, and accrue loyalty progress or points for the order.
POST
A basket can be in one of the following states:
For more on the difference between locked rewards and points-product rewards
when an order is voided or refunded, see
Loyalty Best Practices — Rewards vs Points Products.
HTTP Request
Parameters
string
Basket unique ID. Partner-generated: your system creates this value and reuses it across every state transition for the same basket.
Required for all states other than
checkout. A checkout request may omit the ID; every subsequent state (placed, billed, completed, voided, refunded) must send the same ID the basket was created with.enum
required
Basket state (
checkout, placed, billed, completed, voided,
refunded)string
required
When the order is wanted in (ISO 8601 in UTC). If this timestamp is not
provided, Thanx assumes the order is wanted ASAP.Providing this timestamp allows Thanx to determine if a reward will be valid in the future (for
example, for a weekend only promotion where the user orders in advance).
string
required
Thanx Location UID Providing this information allows Thanx to apply reward
location restrictions.A mapping of Thanx location identifiers can be provided by the Thanx developer
support team or fetched from the following endpoints depending on your integration type:
- Consumer API Get Locations endpoint.
- Partner API Get Locations endpoint.
array(string)
Reward IDs to apply to the basket.These IDs must be obtained from the rewards field at the Get Account API response.If you are integrating with reward codes,
provide the reward code here instead.
Currently only a single reward or points product can be applied to a
basket. The request will 400 if multiple rewards or points products are
specified in the request.
array(string)
Points Product IDs to apply to the basket.These IDs must be obtained from the points_products field at the Get Account API response.
Currently only a single reward or points product can be applied to a
basket. The request will 400 if multiple rewards or points products are
specified in the request.
string
A Universal Promo Code to apply to the basket, as a 1–64 character string.A promo code follows the same lifecycle as a reward:
checkout— the code is validated and the resultingdiscountis returned as a preview; nothing is redeemed yet.placed/billed/completed— the discount is applied and the redemption is recorded (once per basket).voided/refunded— any recorded redemption is released.
A promo code cannot be combined with a reward or points product. Supplying
both returns a 400 — apply one or the other, not both.
A basket
id is required when applying a promo code, and must be reused
across every state update for the basket. The id keys the redemption and
makes retries idempotent, so resending the same basket will not redeem twice.A member is not required to apply a promo code. If the basket is associated
with a member, the order still accrues loyalty as usual; if it is not, the
discount is applied and the redemption is recorded, but the order does not
accrue loyalty (there is no member to credit).
array(hash)
Array of payment methods
Currently only a single object is supported. If multiple entries are provided, only the first will be validated and the rest will be ignored.
array(hash)
required
Array of items
decimal
required
The subtotal of the basket in USD (before taxes & tips)
string
Currently either
instore or online, defaults to online. This is used to
adjust which configured product IDs are returned in the applicable reward and
points product entities.Response
string
Response ID
enum
Basket state (
checkout, placed, billed, completed, voided,
refunded)string
Discount to apply