Skip to main content
GET
/
discounts
/
{discount_id}
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});

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

console.log(discount.business_id);
import os
from dodopayments import DodoPayments

client = DodoPayments(
bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
)
discount = client.discounts.retrieve(
"dsc_qxxEmg5PuM1uNTE0LgkP9",
)
print(discount.business_id)
package main

import (
"context"
"fmt"

"github.com/dodopayments/dodopayments-go"
"github.com/dodopayments/dodopayments-go/option"
)

func main() {
client := dodopayments.NewClient(
option.WithBearerToken("My Bearer Token"),
)
discount, err := client.Discounts.Get(context.TODO(), "dsc_qxxEmg5PuM1uNTE0LgkP9")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", discount.BusinessID)
}
package com.dodopayments.api.example;

import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.discounts.Discount;
import com.dodopayments.api.models.discounts.DiscountRetrieveParams;

public final class Main {
private Main() {}

public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

Discount discount = client.discounts().retrieve("dsc_qxxEmg5PuM1uNTE0LgkP9");
}
}
package com.dodopayments.api.example

import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.discounts.Discount
import com.dodopayments.api.models.discounts.DiscountRetrieveParams

fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

val discount: Discount = client.discounts().retrieve("dsc_qxxEmg5PuM1uNTE0LgkP9")
}
require "dodopayments"

dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)

discount = dodo_payments.discounts.retrieve("dsc_qxxEmg5PuM1uNTE0LgkP9")

puts(discount)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;

$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);

try {
$discount = $client->discounts->retrieve('dsc_qxxEmg5PuM1uNTE0LgkP9');

var_dump($discount);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Discounts;

DodoPaymentsClient client = new();

DiscountRetrieveParams parameters = new()
{
DiscountID = "dsc_qxxEmg5PuM1uNTE0LgkP9"
};

var discount = await client.Discounts.Retrieve(parameters);

Console.WriteLine(discount);
use dodopayments::Client;

#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let discount_id = "discount_id";
let result = client
.discounts()
.retrieve()
.discount_id(discount_id)
.await?;
println!("{result:?}");
Ok(())
}
curl --request GET \
--url https://test.dodopayments.com/discounts/{discount_id} \
--header 'Authorization: Bearer <token>'
{
  "amount": 123,
  "business_id": "<string>",
  "code": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "discount_id": "<string>",
  "metadata": {},
  "preserve_on_plan_change": true,
  "restricted_to": [
    "<string>"
  ],
  "times_used": 123,
  "type": "percentage",
  "expires_at": "2023-11-07T05:31:56Z",
  "name": "<string>",
  "subscription_cycles": 123,
  "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<int32>
required

The discount amount in basis points (e.g., 540 => 5.4%).

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

metadata
Metadata · object
required

Arbitrary key-value metadata. Values can be string, integer, number, or boolean.

preserve_on_plan_change
boolean
required

Whether this discount should be preserved when a subscription changes plans. Default: false (discount is removed on plan change)

restricted_to
string[]
required

List of product IDs to which this discount is restricted.

times_used
integer<int32>
required

How many times this discount has been used.

type
enum<string>
required

The type of discount. Currently only percentage is supported.

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<int32> | 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<int32> | null

Usage limit for this discount, if any.

Last modified on May 26, 2026