Discounts

Update a discount

Updates a discount.

PUT
/discounts/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Request Body

application/json

Discount payload

name?string

Name of the discount.

type?string

Type of discount.

Value in"percentage" | "fixed_amount"
description?string|null

Description of the discount.

percent_off?number|null

Percentage off. Required when type is percentage.

Range0 <= value <= 100
currency?string|null

Currency. Required when type is fixed_amount.

Match^[A-Z]{3}$
amount_off?integer|null

Amount off in currency subunits. Required when type is fixed_amount.

Range0 <= value
recurring?boolean

Whether discount can be applied to multiple billing periods.

max_recurring_intervals?integer|null

Maximum number of billing periods discount can recur (null = forever).

Range1 <= value
max_redemptions?integer|null

Maximum number of redemptions across all accounts.

Range1 <= value
max_redemptions_per_account?integer|null

Maximum number of redemptions per account.

Range1 <= value
valid_from?string|null

Date when the discount becomes valid.

Formatdate-time
valid_until?string|null

Date when the discount expires.

Formatdate-time
metadata?|null

Additional data related to the discount.

Response Body

application/json

curl -X PUT "https://api.sandbox.billingrails.com/v1/discounts/disc_IhMUl3rrZ3" \  -H "Content-Type: application/json" \  -d '{    "name": "Spring Sale Updated"  }'
{
  "discount": {
    "type": "percentage",
    "object": "discount",
    "id": "disc_IhMUl3rrZ3",
    "account_id": null,
    "status": "active",
    "name": "Spring Sale",
    "code": "SPRING2024",
    "description": "15% off for spring season.",
    "percent_off": 15,
    "created_at": "2024-02-14T17:33:40.843Z"
  },
  "meta": {
    "request_id": "req_IhMUl3rrZ3"
  }
}