Update Cart (PUT)

Contents

Purpose

This endpoint is used to add items to the basket of an existing Loyalty transaction, either by scanning pre-selected offers/rewards, or by using the client app’s user interface.

  • Add and remove offers/rewards to the basket of an existing Loyalty transaction, either by scanning pre-selected offers/rewards, or by using the client app’s user interface.

  • Validate an entire basket

Request Format

Endpoint

PUT /loyalty/v2/update

Headers

Bearer token in JWT format as specified in https://rbictg.atlassian.net/wiki/spaces/IN/pages/3739288100.

Body

  • transactionId <UUID>: unique identifier of the Loyalty transaction to be updated.

  • <TBC - cart contents>

Example request

{ "transactionId": "f4190848-169d-4c69-9f53-f916318c432b", }

Content in example request missing an example order payload.

2 examples to be added:

  • one including full order to be validated

  • another example including just an offer/reward to be updated and validated

Response Format

Success response body

  • points <number>: this represents the number of loyalty points the user has. The order has a status of “PENDING” and includes rewards, so this number already has those loyalty points temporarily deducted from total user’s loyalty points balance.

  • pointsEarned <number>: this represents the number of loyalty points the user has earned. The order has a status of “PENDING”, so this number will always be 0 since we don’t update the guests earned loyalty points until the order is completed.

  • pointsRedeemed <number>: this represents the number of loyalty points the user has redeemed. The order has a status of “PENDING” and includes rewards, so this number is the total loyalty points temporarily deducted from total user’s loyalty points balance.

  • loyaltyId <string>: unique identifier of the loyalty user in UUID format.

  • transactionId <string>: unique identifier of the loyalty transaction created in UUID format.

  • receiptCode <string>: autogenerated code for easy lookup of the order via support tool

  • presentation (optional): object that returns Receipt content information set in Sanity here.

    • footer <string> (optional): this represents the content that will show in the footer of the receipt: Loyalty API v1 - Receipts

    • header <string>(optional): this represents the content that will show in the header of the receipt: Loyalty API v1 - Receipts

    • identifier <string>(optional): this represents the content that will show in the receipt to identify the order: Loyalty API v1 - Receipts

    • pointsEarned <string>(optional): this represents the points earned that will show in the receipt of the loyalty order: Loyalty API v1 - Receipts

    • totalPoints <string>(optional): this represents the total points balance that will show in the receipt of the loyalty order: Loyalty API v1 - Receipts

Success response example

{ "points": 14464, "pointsEarned": 50, "pointsRedeemed": 750, "loyaltyId": "4711fc2a-3a8f-414f-a9e7-44dd5231dca7", "footer": "Crowns expire 180 days from last purjchase. At participating U.S. restaurants. Terms at bk.com/rewards-terms.", "header": "My Burger King", "identifier": "Transaction ID: 07e5c312-9e8e-4e67-8980-f42fc499a142", "pointsEarned": "Earned: 50", "totalPoints": "Balance: 14464" }, "receiptCode": "NCGXOZOIY2RUX5VR", "transactionId": "07e5c312-9e8e-4e67-8980-f42fc499a142"

Error responses

All error responses use the standard Loyalty API v1 - Error Responses format.

  • HTTP 400 (Bad Request) if the request body has an incorrect format. In this case, the response will include details about which specific field or fields have an incorrect format.

  • HTTP 401 (Unauthorized) if the bearer token is missing or not valid.

  • HTTP 403 (Forbidden): if the specified identifier is not valid.

  • HTTP 404 (Not Found): if the specified storeId was not found.