APIValidate Coupon API - Check Discount Code | BotSubscription

Validate Coupon - Check Discount Code Eligibility via API

Check if a coupon code is valid for a specific user and purchase amount before applying it. The response shows whether the coupon is eligible, the calculated discount, and the final price—or the reasons why the coupon cannot be used.

POST/v2/projects/{project_id}/coupons/validate

Authorization

Bearer TokenRequired

Path Parameters

project_idstringRequired

The unique identifier of the project.

Request Body

codestringRequired

The coupon code to validate.

user_idstringRequired

The user ID attempting to use the coupon.

amountnumberRequired

The original amount before discount.

currencystringRequired

The currency of the amount (e.g., USD).

Request
curl -X POST "https://api.botsubscription.com/v2/projects/f47ac10b-58cc-4372-a567-0e02b2c3d479/coupons/validate" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "SUMMER2024",
    "user_id": "user_123456789",
    "amount": 29.99,
    "currency": "USD",
    "plan_id": "plan_abc123"
  }'
Coupon eligibleapplication/json
{
  "ok": true,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "POST",
  "path": "/v2/projects/YOUR_PROJECT_ID/coupons/validate",
  "code": 200,
  "data": {
    "coupon_id": "11111111-1111-1111-1111-111111111111",
    "eligible": true,
    "reasons": [],
    "original_amount": "29.99",
    "applied_amount": "6",
    "final_amount": "23.99",
    "currency": "USD"
  }
}

Last updated: