> ## Documentation Index
> Fetch the complete documentation index at: https://docs.loyalty.lt/llms.txt
> Use this file to discover all available pages before exploring further.

# Redeem Coupon

> Redeem a coupon at a shop (Partner API)

# Redeem Coupon

Redeem a verified coupon to apply its benefits. This permanently marks the coupon as used.

<Info>
  This endpoint uses Partner API authentication (X-API-Key and X-API-Secret headers). The coupon must be verified first using the verify endpoint.
</Info>

## Request Body

<ParamField body="coupon_id" type="integer" required>
  The ID of the coupon to redeem (obtained from verify endpoint)
</ParamField>

<ParamField body="shop_id" type="integer" required>
  The ID of the shop where the coupon is being redeemed
</ParamField>

<ParamField body="selected_product_id" type="integer">
  Product ID if the coupon requires product selection
</ParamField>

<ParamField body="notes" type="string">
  Optional notes about the redemption (max 255 characters)
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the coupon was successfully redeemed
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="data">
    <ResponseField name="coupon_id" type="integer">
      The redeemed coupon ID
    </ResponseField>

    <ResponseField name="redeemed_at" type="string">
      ISO 8601 timestamp when the coupon was redeemed
    </ResponseField>

    <ResponseField name="shop_id" type="integer">
      The shop where redemption occurred
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://staging-api.loyalty.lt/en/shop/coupons/redeem" \
    -H "X-API-Key: your_api_key" \
    -H "X-API-Secret: your_api_secret" \
    -H "Content-Type: application/json" \
    -d '{
      "coupon_id": 123,
      "shop_id": 1,
      "selected_product_id": 456
    }'
  ```

  ```javascript JavaScript SDK theme={null}
  import { LoyaltySDK } from '@loyaltylt/sdk';

  const sdk = new LoyaltySDK({
    apiKey: 'your_api_key',
    apiSecret: 'your_api_secret',
    environment: 'staging'
  });

  const result = await sdk.redeemCoupon(123, 1, 456);

  console.log(`Coupon ${result.coupon_id} redeemed at ${result.redeemed_at}`);
  ```
</RequestExample>

<ResponseExample>
  ```json Successful Redemption theme={null}
  {
    "success": true,
    "message": "Coupon redeemed successfully",
    "data": {
      "coupon_id": 123,
      "redeemed_at": "2025-01-15T14:30:00Z",
      "shop_id": 1
    }
  }
  ```

  ```json Coupon Already Used theme={null}
  {
    "success": false,
    "message": "Coupon has already been used",
    "code": "COUPON_ALREADY_USED"
  }
  ```

  ```json Pending at Another Shop theme={null}
  {
    "success": false,
    "message": "Coupon is pending at another shop",
    "code": "OPERATION_NOT_ALLOWED"
  }
  ```
</ResponseExample>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Verify Coupon" icon="magnifying-glass" href="/api-reference/endpoints/shop/coupons/verify">
    Verify coupon before redemption
  </Card>

  <Card title="Set Pending" icon="clock" href="/api-reference/endpoints/shop/coupons/pending">
    Reserve a coupon before redeeming
  </Card>
</CardGroup>
