Discounts
List Discounts
Retrieve a list of all discounts associated with your account.
GET
/
discounts
JavaScript
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const discount of client.discounts.list()) {
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
)
page = client.discounts.list()
page = page.items[0]
print(page.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"),
)
page, err := client.Discounts.List(context.TODO(), dodopayments.DiscountListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.discounts.DiscountListPage;
import com.dodopayments.api.models.discounts.DiscountListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
DiscountListPage page = client.discounts().list();
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.discounts.DiscountListPage
import com.dodopayments.api.models.discounts.DiscountListParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val page: DiscountListPage = client.discounts().list()
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
page = dodo_payments.discounts.list
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
use Dodopayments\Discounts\DiscountType;
$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);
try {
$page = $client->discounts->list(
active: true,
code: 'code',
discountType: DiscountType::PERCENTAGE,
pageNumber: 0,
pageSize: 0,
productID: 'product_id',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Discounts;
DodoPaymentsClient client = new();
DiscountListParams parameters = new();
var page = await client.Discounts.List(parameters);
await foreach (var item in page.Paginate())
{
Console.WriteLine(item);
}use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.discounts()
.list()
.query(serde_json::json!({}))
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/discounts \
--header 'Authorization: Bearer <token>'{
"items": [
{
"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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Page size (default = 10, max = 100).
Required range:
x >= 0Page number (default = 0).
Required range:
x >= 0Filter by discount code (partial match, case-insensitive)
Filter by discount type
Available options:
percentage Filter by active status (true = not expired, false = expired)
Filter by product restriction (only discounts that apply to this product)
Response
List of active Discounts
Array of active (non-deleted) discounts for the current page.
Show child attributes
Show child attributes
Last modified on March 25, 2026
Was this page helpful?
⌘I
JavaScript
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const discount of client.discounts.list()) {
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
)
page = client.discounts.list()
page = page.items[0]
print(page.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"),
)
page, err := client.Discounts.List(context.TODO(), dodopayments.DiscountListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.discounts.DiscountListPage;
import com.dodopayments.api.models.discounts.DiscountListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
DiscountListPage page = client.discounts().list();
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.discounts.DiscountListPage
import com.dodopayments.api.models.discounts.DiscountListParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val page: DiscountListPage = client.discounts().list()
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
page = dodo_payments.discounts.list
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
use Dodopayments\Discounts\DiscountType;
$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);
try {
$page = $client->discounts->list(
active: true,
code: 'code',
discountType: DiscountType::PERCENTAGE,
pageNumber: 0,
pageSize: 0,
productID: 'product_id',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Discounts;
DodoPaymentsClient client = new();
DiscountListParams parameters = new();
var page = await client.Discounts.List(parameters);
await foreach (var item in page.Paginate())
{
Console.WriteLine(item);
}use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.discounts()
.list()
.query(serde_json::json!({}))
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/discounts \
--header 'Authorization: Bearer <token>'{
"items": [
{
"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
}
]
}