Subscriptions
Danh sách Đăng ký
Lấy danh sách tất cả các đăng ký liên kết với tài khoản của bạn.
GET
/
subscriptions
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 subscriptionListResponse of client.subscriptions.list()) {
console.log(subscriptionListResponse.product_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.subscriptions.list()
page = page.items[0]
print(page.product_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.Subscriptions.List(context.TODO(), dodopayments.SubscriptionListParams{})
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.subscriptions.SubscriptionListPage;
import com.dodopayments.api.models.subscriptions.SubscriptionListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
SubscriptionListPage page = client.subscriptions().list();
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.subscriptions.SubscriptionListPage
import com.dodopayments.api.models.subscriptions.SubscriptionListParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val page: SubscriptionListPage = client.subscriptions().list()
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
page = dodo_payments.subscriptions.list
puts(page)<?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 {
$page = $client->subscriptions->list(
brandID: 'brand_id',
cancelAtNextBillingDate: true,
createdAtGte: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
createdAtLte: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
customerID: 'customer_id',
pageNumber: 0,
pageSize: 0,
productID: 'product_id',
status: 'pending',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Subscriptions;
DodoPaymentsClient client = new();
SubscriptionListParams parameters = new();
var page = await client.Subscriptions.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
.subscriptions()
.list()
.query(serde_json::json!({}))
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/subscriptions \
--header 'Authorization: Bearer <token>'{
"items": [
{
"billing": {
"city": "<string>",
"state": "<string>",
"street": "<string>",
"zipcode": "<string>"
},
"cancel_at_next_billing_date": true,
"created_at": "2023-11-07T05:31:56Z",
"customer": {
"customer_id": "<string>",
"email": "<string>",
"name": "<string>",
"metadata": {},
"phone_number": "<string>"
},
"discounts": [
{
"discount_id": "<string>",
"discount_cycles_remaining": 123
}
],
"metadata": {},
"next_billing_date": "2023-11-07T05:31:56Z",
"on_demand": true,
"payment_frequency_count": 123,
"previous_billing_date": "2023-11-07T05:31:56Z",
"product_id": "<string>",
"quantity": 123,
"recurring_pre_tax_amount": 123,
"subscription_id": "<string>",
"subscription_period_count": 123,
"tax_inclusive": true,
"trial_period_days": 123,
"cancelled_at": "2023-11-07T05:31:56Z",
"customer_business_name": "<string>",
"discount_cycles_remaining": 123,
"discount_id": "<string>",
"payment_method_id": "<string>",
"product_name": "<string>",
"scheduled_change": {
"addons": [
{
"addon_id": "<string>",
"name": "<string>",
"quantity": 123
}
],
"created_at": "2023-11-07T05:31:56Z",
"effective_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"product_id": "<string>",
"quantity": 123,
"product_description": "<string>",
"product_name": "<string>"
},
"tax_id": "<string>"
}
]
}Ủy quyền
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Tham số truy vấn
Get events after this created time
Get events created before this time
Page size default is 10 max is 100
Phạm vi bắt buộc:
x >= 0Page number default is 0
Phạm vi bắt buộc:
x >= 0Filter by customer id
Filter by status
Tùy chọn có sẵn:
pending, active, on_hold, cancelled, failed, expired filter by Brand id
Filter by product id
Filter by cancel_at_next_billing_date (subscriptions scheduled for cancellation)
Phản hồi
Show child attributes
Show child attributes
Lần sửa đổi cuối 28 tháng 5, 2026
Trang này có hữu ích không?
⌘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 subscriptionListResponse of client.subscriptions.list()) {
console.log(subscriptionListResponse.product_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.subscriptions.list()
page = page.items[0]
print(page.product_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.Subscriptions.List(context.TODO(), dodopayments.SubscriptionListParams{})
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.subscriptions.SubscriptionListPage;
import com.dodopayments.api.models.subscriptions.SubscriptionListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
SubscriptionListPage page = client.subscriptions().list();
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.subscriptions.SubscriptionListPage
import com.dodopayments.api.models.subscriptions.SubscriptionListParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val page: SubscriptionListPage = client.subscriptions().list()
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
page = dodo_payments.subscriptions.list
puts(page)<?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 {
$page = $client->subscriptions->list(
brandID: 'brand_id',
cancelAtNextBillingDate: true,
createdAtGte: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
createdAtLte: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
customerID: 'customer_id',
pageNumber: 0,
pageSize: 0,
productID: 'product_id',
status: 'pending',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Subscriptions;
DodoPaymentsClient client = new();
SubscriptionListParams parameters = new();
var page = await client.Subscriptions.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
.subscriptions()
.list()
.query(serde_json::json!({}))
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/subscriptions \
--header 'Authorization: Bearer <token>'{
"items": [
{
"billing": {
"city": "<string>",
"state": "<string>",
"street": "<string>",
"zipcode": "<string>"
},
"cancel_at_next_billing_date": true,
"created_at": "2023-11-07T05:31:56Z",
"customer": {
"customer_id": "<string>",
"email": "<string>",
"name": "<string>",
"metadata": {},
"phone_number": "<string>"
},
"discounts": [
{
"discount_id": "<string>",
"discount_cycles_remaining": 123
}
],
"metadata": {},
"next_billing_date": "2023-11-07T05:31:56Z",
"on_demand": true,
"payment_frequency_count": 123,
"previous_billing_date": "2023-11-07T05:31:56Z",
"product_id": "<string>",
"quantity": 123,
"recurring_pre_tax_amount": 123,
"subscription_id": "<string>",
"subscription_period_count": 123,
"tax_inclusive": true,
"trial_period_days": 123,
"cancelled_at": "2023-11-07T05:31:56Z",
"customer_business_name": "<string>",
"discount_cycles_remaining": 123,
"discount_id": "<string>",
"payment_method_id": "<string>",
"product_name": "<string>",
"scheduled_change": {
"addons": [
{
"addon_id": "<string>",
"name": "<string>",
"quantity": 123
}
],
"created_at": "2023-11-07T05:31:56Z",
"effective_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"product_id": "<string>",
"quantity": 123,
"product_description": "<string>",
"product_name": "<string>"
},
"tax_id": "<string>"
}
]
}