iBet uBet web content aggregator. Adding the entire web to your favor.
iBet uBet web content aggregator. Adding the entire web to your favor.



Link to original content: https://docs.lemonsqueezy.com/api/discounts
API Docs: The Discount Object • Lemon Squeezy

The Discount Object

A discount provides details about a percentage or amount off that can be applied to an order at checkout with a code.


A discount belongs to a Store and can have many Discount Redemptions.

Attributes

store_id

The ID of the store this discount belongs to.


name

The name of the discount.


code

The discount code that can be used at checkout. Made up of uppercase letters and numbers and between 3 and 256 characters long.


amount

The amount of discount to apply to the order. Either a fixed amount in cents or a percentage depending on the value of amount_type.


amount_type

The type of the amount. Either percent or fixed.


is_limited_to_products

Has the value true if the discount can only be applied to certain products/variants.


is_limited_redemptions

Has the value true if the discount can only be redeemed a limited number of times.


max_redemptions

If is_limited_redemptions is true, this is the maximum number of redemptions.


starts_at

An ISO 8601 formatted date-time string indicating when the discount is valid from. Can be null if no start date is specified.


expires_at

An ISO 8601 formatted date-time string indicating when the discount expires. Can be null if no expiration date is specified.


duration

If the discount is applied to a subscription, this specifies how often the discount should be applied. One of

  • once - The discount will be applied to the initial payment only.
  • repeating - The discount will be applied to a certain number of payments (use in combination with duration_in_months.
  • forever - The discount will apply to all payments.

duration_in_months

If duration is repeating, this specifies how many months the discount should apply.


status

The status of the discount. Either draft or published.


status_formatted

The formatted status of the discount.


created_at

An ISO 8601 formatted date-time string indicating when the object was created.


updated_at

An ISO 8601 formatted date-time string indicating when the object was last updated.


test_mode

A boolean indicating if the object was created within test mode.

{
  "type": "discounts",
  "id": "1",
  "attributes": {
    "store_id": 1,
    "name": "10%",
    "code": "10PERC",
    "amount": 10,
    "amount_type": "percent",
    "is_limited_to_products": false,
    "is_limited_redemptions": false,
    "max_redemptions": 0,
    "starts_at": null,
    "expires_at": null,
    "duration": "once",
    "duration_in_months": 1,
    "status": "published",
    "status_formatted": "Published",
    "created_at": "2021-05-24T14:15:06.000000Z",
    "updated_at": "2021-05-24T14:15:06.000000Z",
    "test_mode": false
  }
}

Was this page helpful?