Product Collections
Adicionar Produtos ao Grupo
Adicione um ou mais produtos a um grupo dentro de uma coleção de produtos.
POST
/
product-collections
/
{id}
/
groups
/
{group_id}
/
items
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 productCollectionProducts = await client.productCollections.groups.items.create(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ id: 'pdc_8BWv0hojwUH7iCDabr0NI', products: [{ product_id: 'product_id' }] },
);
console.log(productCollectionProducts);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_products = client.product_collections.groups.items.create(
group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
id="pdc_8BWv0hojwUH7iCDabr0NI",
products=[{
"product_id": "product_id"
}],
)
print(product_collection_products)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"),
)
productCollectionProducts, err := client.ProductCollections.Groups.Items.New(
context.TODO(),
"pdc_8BWv0hojwUH7iCDabr0NI",
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
dodopayments.ProductCollectionGroupItemNewParams{
Products: dodopayments.F([]dodopayments.GroupProductParam{{
ProductID: dodopayments.F("product_id"),
}}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", productCollectionProducts)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.productcollections.groups.GroupProduct;
import com.dodopayments.api.models.productcollections.groups.items.ItemCreateParams;
import com.dodopayments.api.models.productcollections.groups.items.ProductCollectionProduct;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ItemCreateParams params = ItemCreateParams.builder()
.id("pdc_8BWv0hojwUH7iCDabr0NI")
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addProduct(GroupProduct.builder()
.productId("product_id")
.build())
.build();
List<ProductCollectionProduct> productCollectionProducts = client.productCollections().groups().items().create(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.productcollections.groups.GroupProduct
import com.dodopayments.api.models.productcollections.groups.items.ItemCreateParams
import com.dodopayments.api.models.productcollections.groups.items.ProductCollectionProduct
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: ItemCreateParams = ItemCreateParams.builder()
.id("pdc_8BWv0hojwUH7iCDabr0NI")
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addProduct(GroupProduct.builder()
.productId("product_id")
.build())
.build()
val productCollectionProducts: List<ProductCollectionProduct> = client.productCollections().groups().items().create(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
product_collection_products = dodo_payments.product_collections.groups.items.create(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
id: "pdc_8BWv0hojwUH7iCDabr0NI",
products: [{product_id: "product_id"}]
)
puts(product_collection_products)<?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 {
$productCollectionProducts = $client
->productCollections
->groups
->items
->create(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
id: 'pdc_8BWv0hojwUH7iCDabr0NI',
products: [['productID' => 'product_id', 'status' => true]],
);
var_dump($productCollectionProducts);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.ProductCollections.Groups.Items;
DodoPaymentsClient client = new();
ItemCreateParams parameters = new()
{
ID = "pdc_8BWv0hojwUH7iCDabr0NI",
GroupID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
Products =
[
new()
{
ProductID = "product_id",
Status = true,
},
],
};
var productCollectionProducts = await client.ProductCollections.Groups.Items.Create(parameters);
Console.WriteLine(productCollectionProducts);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let id = "id";
let group_id = "group_id";
let result = client
.product_collections()
.groups()
.items()
.create()
.id(id)
.group_id(group_id)
.body(dodopayments::models::ProductCollectionsGroupsItemsCreateParams {
products: Some(vec![dodopayments::models::GroupProduct {
product_id: "product_id".to_string(),
status: None,
}]),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/product-collections/{id}/groups/{group_id}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"products": [
{
"product_id": "<string>",
"status": true
}
]
}
'[
{
"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,
"description": "<string>",
"name": "<string>",
"price": 123,
"price_detail": {
"discount": 123,
"price": 123,
"purchasing_power_parity": true,
"type": "one_time_price",
"pay_what_you_want": true,
"suggested_price": 123,
"tax_inclusive": true
},
"tax_inclusive": true
}
]Autorizações
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Parâmetros de caminho
Product Collection Id
Product Collection Group Id
Corpo
application/json
Products to add to the group
Show child attributes
Show child attributes
Resposta
Products added successfully
Whether this product has any credit entitlements attached
Opções disponíveis:
AED, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BWP, BYN, BZD, CAD, CHF, CLP, CNY, COP, CRC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, JMD, JOD, JPY, KES, KGS, KHR, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SEK, SGD, SHP, SLE, SLL, SOS, SRD, SSP, STN, SVC, SZL, THB, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW One-time price details.
- One Time Price
- Recurring Price
- Usage Based Price
Show child attributes
Show child attributes
Represents the different categories of taxation applicable to various products and services.
Opções disponíveis:
digital_products, saas, e_book, edtech Última modificação em 28 de maio de 2026
Esta página foi útil?
Anterior
Atualizar Item do GrupoAtualize um item de produto dentro de um grupo de coleção de produtos.
Próximo
⌘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
});
const productCollectionProducts = await client.productCollections.groups.items.create(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ id: 'pdc_8BWv0hojwUH7iCDabr0NI', products: [{ product_id: 'product_id' }] },
);
console.log(productCollectionProducts);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_products = client.product_collections.groups.items.create(
group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
id="pdc_8BWv0hojwUH7iCDabr0NI",
products=[{
"product_id": "product_id"
}],
)
print(product_collection_products)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"),
)
productCollectionProducts, err := client.ProductCollections.Groups.Items.New(
context.TODO(),
"pdc_8BWv0hojwUH7iCDabr0NI",
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
dodopayments.ProductCollectionGroupItemNewParams{
Products: dodopayments.F([]dodopayments.GroupProductParam{{
ProductID: dodopayments.F("product_id"),
}}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", productCollectionProducts)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.productcollections.groups.GroupProduct;
import com.dodopayments.api.models.productcollections.groups.items.ItemCreateParams;
import com.dodopayments.api.models.productcollections.groups.items.ProductCollectionProduct;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ItemCreateParams params = ItemCreateParams.builder()
.id("pdc_8BWv0hojwUH7iCDabr0NI")
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addProduct(GroupProduct.builder()
.productId("product_id")
.build())
.build();
List<ProductCollectionProduct> productCollectionProducts = client.productCollections().groups().items().create(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.productcollections.groups.GroupProduct
import com.dodopayments.api.models.productcollections.groups.items.ItemCreateParams
import com.dodopayments.api.models.productcollections.groups.items.ProductCollectionProduct
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: ItemCreateParams = ItemCreateParams.builder()
.id("pdc_8BWv0hojwUH7iCDabr0NI")
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addProduct(GroupProduct.builder()
.productId("product_id")
.build())
.build()
val productCollectionProducts: List<ProductCollectionProduct> = client.productCollections().groups().items().create(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
product_collection_products = dodo_payments.product_collections.groups.items.create(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
id: "pdc_8BWv0hojwUH7iCDabr0NI",
products: [{product_id: "product_id"}]
)
puts(product_collection_products)<?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 {
$productCollectionProducts = $client
->productCollections
->groups
->items
->create(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
id: 'pdc_8BWv0hojwUH7iCDabr0NI',
products: [['productID' => 'product_id', 'status' => true]],
);
var_dump($productCollectionProducts);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.ProductCollections.Groups.Items;
DodoPaymentsClient client = new();
ItemCreateParams parameters = new()
{
ID = "pdc_8BWv0hojwUH7iCDabr0NI",
GroupID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
Products =
[
new()
{
ProductID = "product_id",
Status = true,
},
],
};
var productCollectionProducts = await client.ProductCollections.Groups.Items.Create(parameters);
Console.WriteLine(productCollectionProducts);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let id = "id";
let group_id = "group_id";
let result = client
.product_collections()
.groups()
.items()
.create()
.id(id)
.group_id(group_id)
.body(dodopayments::models::ProductCollectionsGroupsItemsCreateParams {
products: Some(vec![dodopayments::models::GroupProduct {
product_id: "product_id".to_string(),
status: None,
}]),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/product-collections/{id}/groups/{group_id}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"products": [
{
"product_id": "<string>",
"status": true
}
]
}
'[
{
"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,
"description": "<string>",
"name": "<string>",
"price": 123,
"price_detail": {
"discount": 123,
"price": 123,
"purchasing_power_parity": true,
"type": "one_time_price",
"pay_what_you_want": true,
"suggested_price": 123,
"tax_inclusive": true
},
"tax_inclusive": true
}
]