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/validateTry it Path Parameters The unique identifier of the project.
Request Body The coupon code to validate.
The user ID attempting to use the coupon.
The original amount before discount.
The currency of the amount (e.g., USD).
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"
}' const project_id = 'f47ac10b-58cc-4372-a567-0e02b2c3d479' ;
const response = await fetch ( `https://api.botsubscription.com/v2/projects/${ project_id }/coupons/validate` , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer YOUR_TOKEN' ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ({
code: 'SUMMER2024' ,
user_id: 'user_123456789' ,
amount: 29.99 ,
currency: 'USD' ,
plan_id: 'plan_abc123'
})
});
const data = await response. json (); import requests
project_id = 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
response = requests.post(
f 'https://api.botsubscription.com/v2/projects/ { project_id } /coupons/validate' ,
headers = {
'Authorization' : 'Bearer YOUR_TOKEN' ,
'Content-Type' : 'application/json'
},
json = {
'code' : 'SUMMER2024' ,
'user_id' : 'user_123456789' ,
'amount' : 29.99 ,
'currency' : 'USD' ,
'plan_id' : 'plan_abc123'
}
)
data = response.json() $project_id = 'f47ac10b-58cc-4372-a567-0e02b2c3d479' ;
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL , "https://api.botsubscription.com/v2/projects/{ $project_id }/coupons/validate" );
curl_setopt ($ch, CURLOPT_POST , true );
curl_setopt ($ch, CURLOPT_HTTPHEADER , [
'Authorization: Bearer YOUR_TOKEN' ,
'Content-Type: application/json'
]);
curl_setopt ($ch, CURLOPT_POSTFIELDS , json_encode ([
'code' => 'SUMMER2024' ,
'user_id' => 'user_123456789' ,
'amount' => 29.99 ,
'currency' => 'USD' ,
'plan_id' => 'plan_abc123'
]));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER , true );
$response = curl_exec ($ch); Coupon eligible application/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"
}
} Coupon not eligible application/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" : false ,
"reasons" : [ "Coupon has expired" ]
}
} Coupon not found application/json
{
"ok" : false ,
"request_id" : "11111111-1111-1111-1111-111111111111" ,
"method" : "POST" ,
"path" : "/v2/projects/YOUR_PROJECT_ID/coupons/validate" ,
"code" : 404 ,
"error" : {
"error_code" : "NOT_FOUND" ,
"message" : "Requested resource could not be found"
}
} Last updated: January 25, 2026
PreviousDelete Coupon Next List Payment Providers