获取产品集合
获取特定产品集合的详细信息。
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});
const productCollection = await client.productCollections.retrieve('pdc_8BWv0hojwUH7iCDabr0NI');
console.log(productCollection.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
)
product_collection = client.product_collections.retrieve(
"pdc_8BWv0hojwUH7iCDabr0NI",
)
print(product_collection.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"),
)
productCollection, err := client.ProductCollections.Get(context.TODO(), "pdc_8BWv0hojwUH7iCDabr0NI")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", productCollection.ID)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.productcollections.ProductCollection;
import com.dodopayments.api.models.productcollections.ProductCollectionRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ProductCollection productCollection = client.productCollections().retrieve("pdc_8BWv0hojwUH7iCDabr0NI");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.productcollections.ProductCollection
import com.dodopayments.api.models.productcollections.ProductCollectionRetrieveParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val productCollection: ProductCollection = client.productCollections().retrieve("pdc_8BWv0hojwUH7iCDabr0NI")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
product_collection = dodo_payments.product_collections.retrieve("pdc_8BWv0hojwUH7iCDabr0NI")
puts(product_collection)<?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 {
$productCollection = $client->productCollections->retrieve(
'pdc_8BWv0hojwUH7iCDabr0NI'
);
var_dump($productCollection);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.ProductCollections;
DodoPaymentsClient client = new();
ProductCollectionRetrieveParams parameters = new()
{
ID = "pdc_8BWv0hojwUH7iCDabr0NI"
};
var productCollection = await client.ProductCollections.Retrieve(parameters);
Console.WriteLine(productCollection);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let id = "id";
let result = client
.product_collections()
.retrieve()
.id(id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/product-collections/{id} \
--header 'Authorization: Bearer <token>'{
"brand_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"groups": [
{
"group_id": "<string>",
"products": [
{
"addons_count": 123,
"files_count": 123,
"has_credit_entitlements": true,
"id": "<string>",
"is_recurring": true,
"license_key_enabled": true,
"meters_count": 123,
"product_id": "<string>",
"status": true,
"currency": "AED",
"description": "<string>",
"name": "<string>",
"price": 123,
"price_detail": {
"currency": "AED",
"discount": 123,
"price": 123,
"type": "one_time_price",
"pay_what_you_want": true,
"purchasing_power_parity": true,
"suggested_price": 123,
"tax_inclusive": true
},
"tax_category": "digital_products",
"tax_inclusive": true
}
],
"status": true,
"group_name": "<string>"
}
],
"id": "<string>",
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"effective_at_on_downgrade": "immediately",
"effective_at_on_upgrade": "immediately",
"image": "<string>",
"on_payment_failure": "prevent_change",
"proration_billing_mode_on_downgrade": "prorated_immediately",
"proration_billing_mode_on_upgrade": "prorated_immediately"
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
路径参数
Product Collection Id
响应
Product Collection Retrieved Successfully
Brand ID for the collection
Timestamp when the collection was created
Groups in this collection
Show child attributes
Show child attributes
Unique identifier for the product collection
Name of the collection
Timestamp when the collection was last updated
Description of the collection
Default effective_at setting for subscription plan downgrades (null = inherit from business)
immediately, next_billing_date Default effective_at setting for subscription plan upgrades (null = inherit from business)
immediately, next_billing_date URL of the collection image
Default behavior for subscription plan changes on payment failure (null = inherit from business)
prevent_change, apply_change Default proration billing mode for subscription plan downgrades (null = inherit from business)
prorated_immediately, full_immediately, difference_immediately, do_not_bill Default proration billing mode for subscription plan upgrades (null = inherit from business)
prorated_immediately, full_immediately, difference_immediately, do_not_bill import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});
const productCollection = await client.productCollections.retrieve('pdc_8BWv0hojwUH7iCDabr0NI');
console.log(productCollection.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
)
product_collection = client.product_collections.retrieve(
"pdc_8BWv0hojwUH7iCDabr0NI",
)
print(product_collection.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"),
)
productCollection, err := client.ProductCollections.Get(context.TODO(), "pdc_8BWv0hojwUH7iCDabr0NI")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", productCollection.ID)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.productcollections.ProductCollection;
import com.dodopayments.api.models.productcollections.ProductCollectionRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ProductCollection productCollection = client.productCollections().retrieve("pdc_8BWv0hojwUH7iCDabr0NI");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.productcollections.ProductCollection
import com.dodopayments.api.models.productcollections.ProductCollectionRetrieveParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val productCollection: ProductCollection = client.productCollections().retrieve("pdc_8BWv0hojwUH7iCDabr0NI")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
product_collection = dodo_payments.product_collections.retrieve("pdc_8BWv0hojwUH7iCDabr0NI")
puts(product_collection)<?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 {
$productCollection = $client->productCollections->retrieve(
'pdc_8BWv0hojwUH7iCDabr0NI'
);
var_dump($productCollection);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.ProductCollections;
DodoPaymentsClient client = new();
ProductCollectionRetrieveParams parameters = new()
{
ID = "pdc_8BWv0hojwUH7iCDabr0NI"
};
var productCollection = await client.ProductCollections.Retrieve(parameters);
Console.WriteLine(productCollection);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let id = "id";
let result = client
.product_collections()
.retrieve()
.id(id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/product-collections/{id} \
--header 'Authorization: Bearer <token>'{
"brand_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"groups": [
{
"group_id": "<string>",
"products": [
{
"addons_count": 123,
"files_count": 123,
"has_credit_entitlements": true,
"id": "<string>",
"is_recurring": true,
"license_key_enabled": true,
"meters_count": 123,
"product_id": "<string>",
"status": true,
"currency": "AED",
"description": "<string>",
"name": "<string>",
"price": 123,
"price_detail": {
"currency": "AED",
"discount": 123,
"price": 123,
"type": "one_time_price",
"pay_what_you_want": true,
"purchasing_power_parity": true,
"suggested_price": 123,
"tax_inclusive": true
},
"tax_category": "digital_products",
"tax_inclusive": true
}
],
"status": true,
"group_name": "<string>"
}
],
"id": "<string>",
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"effective_at_on_downgrade": "immediately",
"effective_at_on_upgrade": "immediately",
"image": "<string>",
"on_payment_failure": "prevent_change",
"proration_billing_mode_on_downgrade": "prorated_immediately",
"proration_billing_mode_on_upgrade": "prorated_immediately"
}