Skip to main content
GET
/
v1
/
discounts
/
validate
TypeScript SDK
import { Solifyn } from 'solifyn';

const solifyn = new Solifyn({ apiKey: 'your_private_api_key_here' });

// Validate discount code for a business
const validation = await solifyn.discounts.validate('SUMMER25', 'biz_019e56a1...');
console.log('Discount Validation Response:', validation);
{
  "id": "disc_cs8f67sd7f6fw3fs",
  "discount_id": "disc_cs8f67sd7f6fw3fs",
  "code": "<string>",
  "amount": 123,
  "usageLimit": 123,
  "timesUsed": 123,
  "expiresAt": "2023-11-07T05:31:56Z",
  "businessId": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "name": "<string>"
}

Authorizations

Authorization
string
header
required

Authenticate requests using your standard bearer API key (e.g. YOUR_API_KEY).

Query Parameters

code
string
required

The plain discount code string

Example:

"SAVE20"

businessId
string
required

The business database ID context

Example:

"biz_123"

Response

200 - application/json

Validation query results.

Represents a discount code created under your business, containing type, amount, usage limits, and expiration details.

id
string
required

The unique prefix-based identifier of the discount (e.g., disc_cs8f67sd7f6fw3fs).

Example:

"disc_cs8f67sd7f6fw3fs"

discount_id
string
required

Alias for the unique identifier of the discount.

Example:

"disc_cs8f67sd7f6fw3fs"

code
string
required

The unique discount code (e.g. SAVE10) used during checkout.

type
enum<string>
required

The discount calculation type: percentage or fixed_amount.

Available options:
percentage,
fixed_amount
amount
integer
required

The discount value. For percentage type, it is in basis points (e.g. 1000 = 10.00%). For fixed_amount type, it is in cents (e.g. 1000 = $10.00).

usageLimit
integer | null
required

Maximum number of times this discount code can be redeemed. Null represents unlimited usage.

timesUsed
integer
required

The number of times this discount code has been successfully redeemed.

expiresAt
string<date-time> | null
required

The expiration timestamp after which the discount code is no longer valid.

status
enum<string>
required

The current status of the discount.

Available options:
active,
expired
businessId
string
required

The unique identifier associated with the business this discount belongs to.

createdAt
string<date-time>
required

Timestamp indicating exactly when the discount was created.

updatedAt
string<date-time>
required

Timestamp indicating when the discount was last updated.

name
string

The customer-facing name of the discount code (e.g. Summer Sale).