GET
/
discounts
/
{discount_id}
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: 'My Bearer Token',
});

const discount = await client.discounts.retrieve('discount_id');

console.log(discount.business_id);
{
  "amount": 123,
  "business_id": "<string>",
  "code": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "discount_id": "<string>",
  "expires_at": "2023-11-07T05:31:56Z",
  "name": "<string>",
  "restricted_to": [
    "<string>"
  ],
  "subscription_cycles": 123,
  "times_used": 123,
  "type": "percentage",
  "usage_limit": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

discount_id
string
required

Discount Id

Response

Fetched discount by ID

amount
integer
required

The discount amount.

  • If discount_type is percentage, this is in basis points (e.g., 540 => 5.4%).
  • Otherwise, this is USD cents (e.g., 100 => $1.00).
business_id
string
required

The business this discount belongs to.

code
string
required

The discount code (up to 16 chars).

created_at
string<date-time>
required

Timestamp when the discount is created

discount_id
string
required

The unique discount ID

restricted_to
string[]
required

List of product IDs to which this discount is restricted.

times_used
integer
required

How many times this discount has been used.

type
enum<string>
required

The type of discount, e.g. percentage, flat, or flat_per_unit.

Available options:
percentage
expires_at
string<date-time> | null

Optional date/time after which discount is expired.

name
string | null

Name for the Discount

subscription_cycles
integer | null

Number of subscription billing cycles this discount is valid for. If not provided, the discount will be applied indefinitely to all recurring payments related to the subscription.

usage_limit
integer | null

Usage limit for this discount, if any.