# TradeIn

Trade-in approval and rejection for order items

## Approve trade-in for order item

> Approves trade-in request for a specific order item.\
> This is part of the trade-in flow where customers can exchange their old products\
> for discounts on new purchases.\
> \
> \*\*Trade-In Feature Overview:\*\*\
> Trade-in allows customers to:\
> 1\. Select a product to trade-in during checkout\
> 2\. Answer questions about the item's condition\
> 3\. Receive a calculated offer price\
> 4\. Complete order with trade-in discount\
> 5\. Approve or reject the final trade-in valuation via email link\
> \
> This endpoint is called when the user clicks the approval link in the trade-in email.\
> \
> \*\*Access Control:\*\*\
> \- User must be authenticated\
> \- Order item must belong to user's order\
> \- Order item must have trade-in inquiry data\
> \- Order item must NOT already be in review status (not already approved or rejected)\
> \
> \*\*Review Status:\*\*\
> Item is considered "in review" if it has already been:\
> \- Approved - Cannot approve again\
> \- Rejected - Cannot approve after rejection\
> \
> If either status exists, returns 404 (cannot change review decision).\
> \
> \*\*Side Effects:\*\*\
> 1\. Sends confirmation to backend system\
> 2\. Updates order item with approved status\
> 3\. Sends trade-in confirmation email to user\
> \
> \*\*Error Handling:\*\*\
> Returns 404 if:\
> \- Order item doesn't exist\
> \- Order item doesn't belong to user\
> \- Order item is already in review (approved or rejected)\
> \- Backend request fails\
> \
> User must own the order containing the item.\
> Item must not already have a review status.

```json
{"openapi":"3.1.0","info":{"title":"Users API - Authentication, Password, Orders, and Hooks","version":"1.0.0"},"tags":[{"name":"TradeIn","description":"Trade-in approval and rejection for order items"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"security":[{"SessionCookie":[]}],"components":{"securitySchemes":{"SessionCookie":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Session cookie for authentication"}},"parameters":{"SessionCookieHeader":{"name":"Cookie","in":"header","required":false,"schema":{"type":"string"},"description":"Session cookie in format `sessionid=<value>`.\nMay use site-specific cookie name (e.g., `osessionid`)."}}},"paths":{"/users/order_item/{pk}/tradein_approved/":{"get":{"tags":["TradeIn"],"operationId":"approveTradeIn","summary":"Approve trade-in for order item","description":"Approves trade-in request for a specific order item.\nThis is part of the trade-in flow where customers can exchange their old products\nfor discounts on new purchases.\n\n**Trade-In Feature Overview:**\nTrade-in allows customers to:\n1. Select a product to trade-in during checkout\n2. Answer questions about the item's condition\n3. Receive a calculated offer price\n4. Complete order with trade-in discount\n5. Approve or reject the final trade-in valuation via email link\n\nThis endpoint is called when the user clicks the approval link in the trade-in email.\n\n**Access Control:**\n- User must be authenticated\n- Order item must belong to user's order\n- Order item must have trade-in inquiry data\n- Order item must NOT already be in review status (not already approved or rejected)\n\n**Review Status:**\nItem is considered \"in review\" if it has already been:\n- Approved - Cannot approve again\n- Rejected - Cannot approve after rejection\n\nIf either status exists, returns 404 (cannot change review decision).\n\n**Side Effects:**\n1. Sends confirmation to backend system\n2. Updates order item with approved status\n3. Sends trade-in confirmation email to user\n\n**Error Handling:**\nReturns 404 if:\n- Order item doesn't exist\n- Order item doesn't belong to user\n- Order item is already in review (approved or rejected)\n- Backend request fails\n\nUser must own the order containing the item.\nItem must not already have a review status.","parameters":[{"$ref":"#/components/parameters/SessionCookieHeader"},{"name":"pk","in":"path","required":true,"schema":{"type":"integer"},"description":"Order item ID. Must belong to an order owned by the authenticated user.\nOrder item must have trade-in inquiry data in attributes."}],"responses":{"200":{"description":"Trade-in approved successfully.\nOrder item updated with confirmed flag, backend notified, email sent."},"401":{"description":"Authentication required"},"404":{"description":"Order item not found, not owned by user, already reviewed,\nor backend request failed"}}}}}}
```

## Reject trade-in for order item

> Rejects trade-in request for a specific order item.\
> This is part of the trade-in flow where customers can exchange their old products\
> for discounts on new purchases.\
> \
> \*\*Trade-In Feature Overview:\*\*\
> Trade-in allows customers to:\
> 1\. Select a product to trade-in during checkout\
> 2\. Answer questions about the item's condition\
> 3\. Receive a calculated offer price\
> 4\. Complete order with trade-in discount\
> 5\. Approve or reject the final trade-in valuation via email link\
> \
> This endpoint is called when the user clicks the rejection link in the trade-in email.\
> \
> \*\*Access Control:\*\*\
> \- User must be authenticated\
> \- Order item must belong to user's order\
> \- Order item must have trade-in inquiry data\
> \- Order item must NOT already be in review status (not already approved or rejected)\
> \
> \*\*Review Status:\*\*\
> Item is considered "in review" if it has already been:\
> \- Approved - Cannot reject after approval\
> \- Rejected - Cannot reject again\
> \
> If either status exists, returns 404 (cannot change review decision).\
> \
> \*\*Side Effects:\*\*\
> 1\. Sends rejection to backend system\
> 2\. Updates order item with rejected status\
> 3\. Sends trade-in rejection email to user\
> \
> \*\*Error Handling:\*\*\
> Returns 404 if:\
> \- Order item doesn't exist\
> \- Order item doesn't belong to user\
> \- Order item is already in review (approved or rejected)\
> \- Backend request fails\
> \
> User must own the order containing the item.\
> Item must not already have a review status.

```json
{"openapi":"3.1.0","info":{"title":"Users API - Authentication, Password, Orders, and Hooks","version":"1.0.0"},"tags":[{"name":"TradeIn","description":"Trade-in approval and rejection for order items"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"security":[{"SessionCookie":[]}],"components":{"securitySchemes":{"SessionCookie":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Session cookie for authentication"}},"parameters":{"SessionCookieHeader":{"name":"Cookie","in":"header","required":false,"schema":{"type":"string"},"description":"Session cookie in format `sessionid=<value>`.\nMay use site-specific cookie name (e.g., `osessionid`)."}}},"paths":{"/users/order_item/{pk}/tradein_rejected/":{"get":{"tags":["TradeIn"],"operationId":"rejectTradeIn","summary":"Reject trade-in for order item","description":"Rejects trade-in request for a specific order item.\nThis is part of the trade-in flow where customers can exchange their old products\nfor discounts on new purchases.\n\n**Trade-In Feature Overview:**\nTrade-in allows customers to:\n1. Select a product to trade-in during checkout\n2. Answer questions about the item's condition\n3. Receive a calculated offer price\n4. Complete order with trade-in discount\n5. Approve or reject the final trade-in valuation via email link\n\nThis endpoint is called when the user clicks the rejection link in the trade-in email.\n\n**Access Control:**\n- User must be authenticated\n- Order item must belong to user's order\n- Order item must have trade-in inquiry data\n- Order item must NOT already be in review status (not already approved or rejected)\n\n**Review Status:**\nItem is considered \"in review\" if it has already been:\n- Approved - Cannot reject after approval\n- Rejected - Cannot reject again\n\nIf either status exists, returns 404 (cannot change review decision).\n\n**Side Effects:**\n1. Sends rejection to backend system\n2. Updates order item with rejected status\n3. Sends trade-in rejection email to user\n\n**Error Handling:**\nReturns 404 if:\n- Order item doesn't exist\n- Order item doesn't belong to user\n- Order item is already in review (approved or rejected)\n- Backend request fails\n\nUser must own the order containing the item.\nItem must not already have a review status.","parameters":[{"$ref":"#/components/parameters/SessionCookieHeader"},{"name":"pk","in":"path","required":true,"schema":{"type":"integer"},"description":"Order item ID. Must belong to an order owned by the authenticated user.\nOrder item must have trade-in inquiry data in attributes."}],"responses":{"200":{"description":"Trade-in rejected successfully.\nOrder item updated with rejected flag, backend notified, email sent."},"401":{"description":"Authentication required"},"404":{"description":"Order item not found, not owned by user, already reviewed,\nor backend request failed"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.akinon.com/commerce-openapis/users/module-3/tradein.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
