الانتقال إلى المحتوى الرئيسي
GET
/
product-collections
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 productCollectionListResponse of client.productCollections.list()) {
  console.log(productCollectionListResponse.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.product_collections.list()
page = page.items[0]
print(page.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.ProductCollections.List(context.TODO(), dodopayments.ProductCollectionListParams{})
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.productcollections.ProductCollectionListPage;
import com.dodopayments.api.models.productcollections.ProductCollectionListParams;

public final class Main {
private Main() {}

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

ProductCollectionListPage page = client.productCollections().list();
}
}
package com.dodopayments.api.example

import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.productcollections.ProductCollectionListPage
import com.dodopayments.api.models.productcollections.ProductCollectionListParams

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

val page: ProductCollectionListPage = client.productCollections().list()
}
require "dodopayments"

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

page = dodo_payments.product_collections.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->productCollections->list(
archived: true, brandID: 'brand_id', pageNumber: 0, pageSize: 0
);

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

DodoPaymentsClient client = new();

ProductCollectionListParams parameters = new();

var page = await client.ProductCollections.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
.product_collections()
.list()
.query(serde_json::json!({}))
.await?;
println!("{result:?}");
Ok(())
}
curl --request GET \
--url https://test.dodopayments.com/product-collections \
--header 'Authorization: Bearer <token>'
{
  "items": [
    {
      "created_at": "2023-11-07T05:31:56Z",
      "id": "<string>",
      "name": "<string>",
      "products_count": 123,
      "updated_at": "2023-11-07T05:31:56Z",
      "description": "<string>",
      "image": "<string>"
    }
  ]
}

التفويضات

Authorization
string
header
مطلوب

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

معلمات الاستعلام

page_size
integer<int32>

Page size default is 10 max is 100

النطاق المطلوب: x >= 0
page_number
integer<int32>

Page number default is 0

النطاق المطلوب: x >= 0
archived
boolean

List archived collections

brand_id
string

Filter by Brand id

الاستجابة

Product Collections List

items
object[]
مطلوب
آخر تعديل في ١٨ يونيو ٢٠٢٦