Verify coupon
curl --request POST \
--url https://store.salesive.com/api/v1/coupons/verify \
--header 'Content-Type: application/json' \
--data '
{
"code": "SUMMER20",
"orderId": "67890abcdef1234567890abc"
}
'import requests
url = "https://store.salesive.com/api/v1/coupons/verify"
payload = {
"code": "SUMMER20",
"orderId": "67890abcdef1234567890abc"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({code: 'SUMMER20', orderId: '67890abcdef1234567890abc'})
};
fetch('https://store.salesive.com/api/v1/coupons/verify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/coupons/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => 'SUMMER20',
'orderId' => '67890abcdef1234567890abc'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/coupons/verify"
payload := strings.NewReader("{\n \"code\": \"SUMMER20\",\n \"orderId\": \"67890abcdef1234567890abc\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://store.salesive.com/api/v1/coupons/verify")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"SUMMER20\",\n \"orderId\": \"67890abcdef1234567890abc\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/coupons/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"SUMMER20\",\n \"orderId\": \"67890abcdef1234567890abc\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"success": true,
"message": "Coupon is valid",
"data": {
"_id": "<string>",
"code": "<string>",
"type": "fixed",
"discount": 123,
"discountAmount": 123,
"minimumOrderAmount": 123,
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"title": "<string>"
}
}Coupons
Verify coupon
Validate a coupon code and calculate the discount amount before applying it to an order.
POST
/
coupons
/
verify
Verify coupon
curl --request POST \
--url https://store.salesive.com/api/v1/coupons/verify \
--header 'Content-Type: application/json' \
--data '
{
"code": "SUMMER20",
"orderId": "67890abcdef1234567890abc"
}
'import requests
url = "https://store.salesive.com/api/v1/coupons/verify"
payload = {
"code": "SUMMER20",
"orderId": "67890abcdef1234567890abc"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({code: 'SUMMER20', orderId: '67890abcdef1234567890abc'})
};
fetch('https://store.salesive.com/api/v1/coupons/verify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/coupons/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => 'SUMMER20',
'orderId' => '67890abcdef1234567890abc'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/coupons/verify"
payload := strings.NewReader("{\n \"code\": \"SUMMER20\",\n \"orderId\": \"67890abcdef1234567890abc\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://store.salesive.com/api/v1/coupons/verify")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"SUMMER20\",\n \"orderId\": \"67890abcdef1234567890abc\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/coupons/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"SUMMER20\",\n \"orderId\": \"67890abcdef1234567890abc\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"success": true,
"message": "Coupon is valid",
"data": {
"_id": "<string>",
"code": "<string>",
"type": "fixed",
"discount": 123,
"discountAmount": 123,
"minimumOrderAmount": 123,
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"title": "<string>"
}
}Request
POST /coupons/verify
Content-Type: application/json
x-shop-id: {shopId}
Authorization: Bearer {token}
{
"code": "SUMMER20",
"orderId": "67890abcdef1234567890abc"
}
Headers
| Header | Type | Description |
|---|---|---|
Content-Type | string | Always set to application/json. |
x-shop-id | string | Shop identifier to associate the user with your store. |
Authorization | string | Optional Bearer token for authenticated requests. |
This endpoint supports both authenticated and unauthenticated requests.
Authentication is optional but recommended to validate user-specific coupon
usage limits.
Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Coupon code to verify (case-insensitive). |
orderId | string | No | Order ID to validate coupon against order total. |
Successful response
{
"status": 200,
"success": true,
"message": "Coupon is valid",
"data": {
"_id": "67890abcdef1234567890abc",
"code": "SUMMER20",
"type": "percentage",
"discount": 20,
"discountAmount": 200,
"minimumOrderAmount": 500,
"startDate": "2025-01-01T00:00:00.000Z",
"endDate": "2025-12-31T23:59:59.000Z",
"title": "20% off order above 500"
}
}
Response fields
| Field | Type | Description |
|---|---|---|
_id | string | Unique coupon identifier. |
code | string | Coupon code. |
type | string | Coupon type: fixed or percentage. |
discount | number | Discount value (fixed amount or percentage). |
discountAmount | number | Calculated discount amount based on order subtotal. |
minimumOrderAmount | number | Minimum order amount required to use the coupon. |
startDate | string | Date when the coupon becomes active. |
endDate | string | Date when the coupon expires. |
title | string | Human-readable description of the coupon discount offer. |
Validation checks
The endpoint performs the following validations:Coupon exists and is active
Coupon belongs to the specified shop
Coupon is within valid date range (between start and end dates)
Global usage limit has not been exceeded
Per-user usage limit has not been exceeded (for authenticated users)
Order meets minimum amount requirement (if orderId provided)
Error responses
Invalid coupon code
{
"status": 404,
"success": false,
"message": "Invalid coupon code"
}
Coupon expired
{
"status": 400,
"success": false,
"message": "Coupon has expired"
}
Minimum order not met
{
"status": 400,
"success": false,
"message": "Minimum order amount of 500 required to use this coupon"
}
Usage limit reached
{
"status": 400,
"success": false,
"message": "You have already used this coupon 1 time(s)"
}
Headers
Optional identifier that scopes responses to a specific storefront when the referer cannot be inferred.
Body
application/json
Was this page helpful?

