POST
/
api
/
baskets
curl https://loyalty.thanxsandbox.com/api/baskets \
  -X POST \
  -H "Authorization: Bearer 945148251b603ae34561d90acfe4050e67494d6d1e65d4d3d52798407f03c0bd" \
  -H "Content-Type: application/json" \
  -H "Accept: application/vnd.thanx-v1+json" \
  -H "Merchant-Key: cb71e3" \
  -H "Reward-Redemption-Token: code1234" \
  -d '{
    "id": "gwer-werwr-2134-rty",
    "state": "billed",
    "order_timestamp": "2019-05-08T18:02:05Z",
    "location_uid": "LG-567fhwer",
    "rewards": [
      "fheTRR"
    ],
    "payments": [
      {
        "issuer": "visa",
        "last4": "1234",
        "amount": 10.45,
        "authorized_at": "2019-05-07T18:02:05Z"
      }
    ],
    "items": [
      {
        "id": "ng-23492",
        "name": "Cheese Pizza",
        "price": 9.95,
        "categories": [
          "pizza",
          "vegetarian"
        ],
        "modifiers": [
          {
            "id": "mod-123",
            "name": "Extra Cheese",
            "price": 1.50,
            "item_base_price": 8.45
          }
        ]
      }
    ],
    "subtotal": 23.45
  }'
{
  "id": "fhwerwe-23663-ryryre",
  "state": "checkout",
  "discount": "10.25"
}
A basket can be in one of the following states:
StateDescription
checkoutrequired Refers to any point before the order is placed. Any time the user updates their basket or rewards, Thanx expects to receive a request to check if discount information should be updated.
placedrequired Refers to when an order has been submitted to the system and a user can no longer modify their order through the website. If a reward is specified, the reward will be locked. If a points product is specified, the user’s points balance will be deducted in exchange for specified reward and the reward will be locked.
billedrequired Refers to when the order has been trasmitted to the POS and the user’s credit card has been charged. Any specified reward will be marked as used. Loyalty progress or points will be accrued upon receipt of this event.
completedrecommended Refers to when the order has been made and transferred to the customer.
voidedrecommended Refers to an order that got canceled after entering the placed state and before entering the billed state. Any locked reward will be re-delivered to the user. Points were exchanged for a points product will not be redelivered, but the points product reward will be available for future redemption.
refundedrecommended Refers to an order being refunded / canceled any time after it enters the billed state. Any locked reward will be re-delivered to the user. Points were exchanged for a points product will not be redelivered, but the points product reward will be available for future redemption.
Only a single reward or points product can be redeemed per order.

HTTP Request

Parameters

id
string
Basket unique ID
Basket ID is not required when submitting a basket with ‘checkout’ state.
state
enum
Basket state (checkout, placed, billed, completed, voided, refunded)
order_timestamp
string
When the order is wanted in (ISO 8601 format). 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)
location_uid
string
The location identifier; this is what your system uses to identify a location. Providing this information allows Thanx to apply location restricted rewards.
rewards
array(string)
Reward IDs to apply to the basket. 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.
points_products
array(string)
Points Product IDs to apply to the basket.
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.
payments
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.
items
array(hash)
Array of items
subtotal
decimal
The subtotal of the basket in USD (before taxes & tips)
redemption_venue
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

id
string
Response ID
state
enum
Basket state (checkout, placed, billed, completed, voided, refunded)
discount
string
Discount to apply
curl https://loyalty.thanxsandbox.com/api/baskets \
  -X POST \
  -H "Authorization: Bearer 945148251b603ae34561d90acfe4050e67494d6d1e65d4d3d52798407f03c0bd" \
  -H "Content-Type: application/json" \
  -H "Accept: application/vnd.thanx-v1+json" \
  -H "Merchant-Key: cb71e3" \
  -H "Reward-Redemption-Token: code1234" \
  -d '{
    "id": "gwer-werwr-2134-rty",
    "state": "billed",
    "order_timestamp": "2019-05-08T18:02:05Z",
    "location_uid": "LG-567fhwer",
    "rewards": [
      "fheTRR"
    ],
    "payments": [
      {
        "issuer": "visa",
        "last4": "1234",
        "amount": 10.45,
        "authorized_at": "2019-05-07T18:02:05Z"
      }
    ],
    "items": [
      {
        "id": "ng-23492",
        "name": "Cheese Pizza",
        "price": 9.95,
        "categories": [
          "pizza",
          "vegetarian"
        ],
        "modifiers": [
          {
            "id": "mod-123",
            "name": "Extra Cheese",
            "price": 1.50,
            "item_base_price": 8.45
          }
        ]
      }
    ],
    "subtotal": 23.45
  }'
{
  "id": "fhwerwe-23663-ryryre",
  "state": "checkout",
  "discount": "10.25"
}