Redeem store item
POST/store/redeem
Redeems a store item using gems.
Idempotency behavior:
- send
Idempotency-Keyper purchase attempt for safe retries - same key + same user returns the previous redemption
- same key reused by a different user returns
409
Request
Responses
- 200
- 400
- 401
- 402
- 403
- 409
- 422
Successful Response
Bad Request
Unauthorized
Payment Required
Forbidden
Conflict
Validation Error
Request body
{
"store_item_id": 12,
"shipping_address": null
}
shipping_address is required when the item uses webhook/physical fulfillment.
Physical example:
{
"store_item_id": 99,
"shipping_address": {
"name": "Rahul Nema",
"line1": "123 MG Road",
"line2": "Near Metro",
"city": "Bengaluru",
"state": "Karnataka",
"pincode": "560001",
"phone": "+919999999999"
}
}
Response shape
{
"id": 834,
"status": "fulfilled",
"gem_cost_at_time": 150,
"fulfillment_data": {
"code": "AMZN-XXXX-YYYY",
"pin": "1234"
}
}
Redemption behavior
- Server validates item existence and availability window.
- Server checks stock and per-player limit.
- Server checks wallet gems.
- Server deducts gems and records wallet transaction.
- Server creates redemption record.
- Fulfillment output depends on fulfillment strategy:
code_pool: response often returnsstatus = fulfilledwith code/pin- webhook/provider flows: response is usually
status = pendinguntil downstream completion
cURL examples
Redeem voucher:
curl -X POST "http://localhost:8001/store/redeem" \
-H "x-client-id: <client-id>" \
-H "x-client-secret: <client-secret>" \
-H "Authorization: Bearer <access-token>" \
-H "Idempotency-Key: user-42:item-12:order-1001" \
-H "Content-Type: application/json" \
-d '{"store_item_id":12}'
Redeem physical item:
curl -X POST "http://localhost:8001/store/redeem" \
-H "x-client-id: <client-id>" \
-H "x-client-secret: <client-secret>" \
-H "Authorization: Bearer <access-token>" \
-H "Idempotency-Key: user-42:item-99:order-1002" \
-H "Content-Type: application/json" \
-d '{"store_item_id":99,"shipping_address":{"name":"Rahul Nema","line1":"123 MG Road","city":"Bengaluru","state":"Karnataka","pincode":"560001","phone":"+919999999999"}}'