Products
Cập nhật tệp sản phẩm
Cập nhật các tệp liên quan đến một sản phẩm.
PUT
/
products
/
{id}
/
files
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 response = await client.products.updateFiles('pdt_R8AWMPiV8RyJElcCKvAID', {
file_name: 'file_name',
});
console.log(response.file_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
)
response = client.products.update_files(
id="pdt_R8AWMPiV8RyJElcCKvAID",
file_name="file_name",
)
print(response.file_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"),
)
response, err := client.Products.UpdateFiles(
context.TODO(),
"pdt_R8AWMPiV8RyJElcCKvAID",
dodopayments.ProductUpdateFilesParams{
FileName: dodopayments.F("file_name"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.FileID)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.products.ProductUpdateFilesParams;
import com.dodopayments.api.models.products.ProductUpdateFilesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ProductUpdateFilesParams params = ProductUpdateFilesParams.builder()
.id("pdt_R8AWMPiV8RyJElcCKvAID")
.fileName("file_name")
.build();
ProductUpdateFilesResponse response = client.products().updateFiles(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.products.ProductUpdateFilesParams
import com.dodopayments.api.models.products.ProductUpdateFilesResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: ProductUpdateFilesParams = ProductUpdateFilesParams.builder()
.id("pdt_R8AWMPiV8RyJElcCKvAID")
.fileName("file_name")
.build()
val response: ProductUpdateFilesResponse = client.products().updateFiles(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.products.update_files("pdt_R8AWMPiV8RyJElcCKvAID", file_name: "file_name")
puts(response)<?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 {
$response = $client->products->updateFiles(
'pdt_R8AWMPiV8RyJElcCKvAID', fileName: 'file_name'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Products;
DodoPaymentsClient client = new();
ProductUpdateFilesParams parameters = new()
{
ID = "pdt_R8AWMPiV8RyJElcCKvAID",
FileName = "file_name",
};
var response = await client.Products.UpdateFiles(parameters);
Console.WriteLine(response);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let id = "id";
let result = client
.products()
.update_files()
.id(id)
.body(dodopayments::models::ProductsUpdateFilesParams {
file_name: Some("file_name".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request PUT \
--url https://test.dodopayments.com/products/{id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_name": "<string>"
}
'{
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>"
}Ủy quyền
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Tham số đường dẫn
Product Id
Nội dung
application/json
Lần sửa đổi cuối 28 tháng 5, 2026
Trang này có hữu ích không?
Trước
Danh sách Liên kết NgắnLiệt kê tất cả các liên kết ngắn được tạo bởi doanh nghiệp. Các liên kết ngắn cung cấp URL thanh toán rút gọn với các slug tùy chỉnh cho sản phẩm của bạn.
Tiếp theo
⌘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 response = await client.products.updateFiles('pdt_R8AWMPiV8RyJElcCKvAID', {
file_name: 'file_name',
});
console.log(response.file_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
)
response = client.products.update_files(
id="pdt_R8AWMPiV8RyJElcCKvAID",
file_name="file_name",
)
print(response.file_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"),
)
response, err := client.Products.UpdateFiles(
context.TODO(),
"pdt_R8AWMPiV8RyJElcCKvAID",
dodopayments.ProductUpdateFilesParams{
FileName: dodopayments.F("file_name"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.FileID)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.products.ProductUpdateFilesParams;
import com.dodopayments.api.models.products.ProductUpdateFilesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ProductUpdateFilesParams params = ProductUpdateFilesParams.builder()
.id("pdt_R8AWMPiV8RyJElcCKvAID")
.fileName("file_name")
.build();
ProductUpdateFilesResponse response = client.products().updateFiles(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.products.ProductUpdateFilesParams
import com.dodopayments.api.models.products.ProductUpdateFilesResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: ProductUpdateFilesParams = ProductUpdateFilesParams.builder()
.id("pdt_R8AWMPiV8RyJElcCKvAID")
.fileName("file_name")
.build()
val response: ProductUpdateFilesResponse = client.products().updateFiles(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.products.update_files("pdt_R8AWMPiV8RyJElcCKvAID", file_name: "file_name")
puts(response)<?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 {
$response = $client->products->updateFiles(
'pdt_R8AWMPiV8RyJElcCKvAID', fileName: 'file_name'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Products;
DodoPaymentsClient client = new();
ProductUpdateFilesParams parameters = new()
{
ID = "pdt_R8AWMPiV8RyJElcCKvAID",
FileName = "file_name",
};
var response = await client.Products.UpdateFiles(parameters);
Console.WriteLine(response);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let id = "id";
let result = client
.products()
.update_files()
.id(id)
.body(dodopayments::models::ProductsUpdateFilesParams {
file_name: Some("file_name".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request PUT \
--url https://test.dodopayments.com/products/{id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_name": "<string>"
}
'{
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>"
}