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

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

// Update discount code settings
const discount = await solifyn.discounts.update('disc_019e56a1...', {
  name: 'End of Summer Sale',
  amount: 30
});
console.log('Discount Updated:', discount);
{
  "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).

Path Parameters

id
string
required

The unique discount ID.

Example:

"disc_123"

Body

application/json
name
string

Customer-facing name of the discount.

type
enum<string>

Calculation type: percentage or fixed_amount.

Available options:
percentage,
fixed_amount
amount
number

The discount value.

usage_limit
integer | null

Maximum number of redemptions allowed.

expires_at
string<date-time> | null

Expiration timestamp for the discount.

subscription_cycles
integer | null

Number of subscription cycles this discount applies to.

restricted_to
string[]

List of product IDs this discount is restricted to.

preserve_on_plan_change
boolean

Whether to preserve the discount when subscription plan changes.

metadata
object

Custom metadata for the discount.

Response

200 - application/json

Discount updated successfully.

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).