# Checkout API with rewards

**URL:** <https://developer.squareup.com/forums/t/checkout-api-with-rewards/4270>\
**Category:** Questions\
**Tags:** payments-api\
**Created:** [November 18, 2021, 11:28am UTC](https://developer.squareup.com/forums/t/checkout-api-with-rewards/4270 "2021-11-18T11:28:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vasan](https://avatars.discourse-cdn.com/v4/letter/v/f1d935/32.png) [@vasan](https://developer.squareup.com/forums/u/vasan)\
**Post date:** [November 18, 2021, 11:28am UTC](https://developer.squareup.com/forums/t/checkout-api-with-rewards/4270/1 "2021-11-18T11:28:33Z")

</div>

How can we add rewards to checkout-api. There are ‘Read-only’ fields (reward, reward-tier-id) ([POST /v2/locations/{location\_id}/checkouts - Square API Reference](https://developer.squareup.com/reference/square/checkout-api/create-checkout) - order attributes. I found some hint in [How can I generate the Checkout URL for existing Order](https://developer.squareup.com/forums/t/how-can-i-generate-the-checkout-url-for-existing-order/3351) where it asks you to use calculate (where you can propose rewards) and copy the order into the checkout-api  
Another hint is to create the order , add the rewards using qttps://developer.squareup.com/reference/square/loyalty-api/create-loyalty-reward with the order\_id, then retrieve the order, and include the order (as a new order) into checkout.  
Both of these seem difficult and awkward, and may not work.  
Is there an easier way?  
Thanks  
-Vasan

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 18, 2021, 5:58pm UTC](https://developer.squareup.com/forums/t/checkout-api-with-rewards/4270/3 "2021-11-18T17:58:55Z")

</div>

👋 With the Checkout API you will need to use [CalculateOrder](https://developer.squareup.com/reference/square/orders-api/calculate-order) first then create the checkout with that calculated order. 🙂

---

<div class="post-metadata">

**Author:** ![vasan](https://avatars.discourse-cdn.com/v4/letter/v/f1d935/32.png) [@vasan](https://developer.squareup.com/forums/u/vasan)\
**Post date:** [November 19, 2021, 5:06am UTC](https://developer.squareup.com/forums/t/checkout-api-with-rewards/4270/4 "2021-11-19T05:06:15Z")

</div>

Not sure this works. Calculate order does create an order with rewards, but cannot put that into the checkout API ([POST /v2/locations/{location\_id}/checkouts - Square API Reference](https://developer.squareup.com/reference/square/checkout-api/create-checkout)) because many ‘read-only’ fields are in there which cannot be specified. If you remove them, then the rewards are not appiled. It looks like the checkout-api wants to recalculate the order, but is missing the ‘proposed\_rewards’ parameter (which is there in calculate order). It looks like there may be some other way or…

---

<div class="post-metadata">

**Author:** ![vasan](https://avatars.discourse-cdn.com/v4/letter/v/f1d935/32.png) [@vasan](https://developer.squareup.com/forums/u/vasan)\
**Post date:** [November 19, 2021, 1:40pm UTC](https://developer.squareup.com/forums/t/checkout-api-with-rewards/4270/5 "2021-11-19T13:40:40Z")

</div>

Ignore my previous comment…Am still working on this. Will post results (hopefully successful)

---

<div class="post-metadata">

**Author:** ![vasan](https://avatars.discourse-cdn.com/v4/letter/v/f1d935/32.png) [@vasan](https://developer.squareup.com/forums/u/vasan)\
**Post date:** [November 19, 2021, 2:25pm UTC](https://developer.squareup.com/forums/t/checkout-api-with-rewards/4270/6 "2021-11-19T14:25:35Z")

</div>

Hooray… Got it to work after deleteing read-only fields, and ‘redundant info’ (like name if catalog\_object\_id is there) and responded to all error messages, and it did work (Thx)

New problem: On the checkout page, it applies the discount(or reward), but does no indicate clearly that it did:  
 ![image](https://global.discourse-cdn.com/square/original/1X/988c7d91c96990f74daf1a5ae9ba6eb6ee5419c4.png)  
In that image note that 3.95 for the Baklava is not added to the total, but the display is not clear that it happened.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 19, 2021, 7:57pm UTC](https://developer.squareup.com/forums/t/checkout-api-with-rewards/4270/7 "2021-11-19T19:57:05Z")

</div>

What is the `order_id` for that checkout?

---

<div class="post-metadata">

**Author:** ![vasan](https://avatars.discourse-cdn.com/v4/letter/v/f1d935/32.png) [@vasan](https://developer.squareup.com/forums/u/vasan)\
**Post date:** [November 20, 2021, 3:17pm UTC](https://developer.squareup.com/forums/t/checkout-api-with-rewards/4270/8 "2021-11-20T15:17:46Z")

</div>

Sorry for the late reply. I have a more recent one:  
“order\_id”: “JjkAfEamSIo1oU5SkQItvcHGAhaZY”  
The entire order sent to checkout is:  
{  
“idempotency\_key”: “e255bf15-302c-4777-b237-e1c83736c2f4”,  
“order”: {  
“idempotency\_key”: “e255bf15-302c-4777-b237-e1c83736c2f4”,  
“order”: {  
“location\_id”: “LQ6P723BZTYYR”,  
“reference\_id”: “e255bf15-302c-4777-b237-e1c83736c2f4”,  
“customer\_id”: “6P1EH8SGACSKN1166XMA7MEHXW”,  
“line\_items”: [  
{  
“catalog\_object\_id”: “VVYXH63ULGL67SXPY4G2VO24”,  
“quantity”: “1”  
},  
{  
“catalog\_object\_id”: “DCUQIWODU5IUYPM4CADARZLX”,  
“quantity”: “1”,  
“applied\_discounts”: [  
{  
“uid”: “1eBMKPKqMK0Igzr7odtUK”,  
“discount\_uid”: “JgIEoOF9OONgCZXEwh7d8”  
}  
]  
}  
],  
“metadata”: {  
“xid”: “e255bf15-302c-4777-b237-e1c83736c2f4”,  
“cxFNm”: “NA”,  
“cxLNm”: “NA”,  
“orderType”: “pickup”,  
“cxPhNo”: “+15624482878”  
},  
“fullfillments”: [  
{  
“uid”: “e255bf15-302c-4777-b237-e1c83736c2f4”,  
“type”: “pickup”,  
“state”: “PROPOSED”,  
“metadata”: {  
“customer”: 15624482878  
}  
}  
],  
“discounts”: [  
{  
“uid”: “JgIEoOF9OONgCZXEwh7d8”,  
“catalog\_object\_id”: “EVZULUT7GGK667CFU4UKXN2G”,  
“catalog\_version”: 1636297483097,  
“percentage”: “100.0”,  
“applied\_money”: {  
“amount”: 395,  
“currency”: “USD”  
},  
“scope”: “LINE\_ITEM”  
}  
]  
}  
},  
“redirect\_url”: “[https://xxxx/squareapi/cart/paid](https://xxxx/squareapi/cart/paid)”  
}
