Webhooks
Lấy Khóa Ký Webhook
Lấy khóa ký cho một webhook cụ thể.
GET
/
webhooks
/
{webhook_id}
/
secret
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.webhooks.retrieveSecret('whk_YdWqVEGKmSYKbsIyDxEab');
console.log(response.secret);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.webhooks.retrieve_secret(
"whk_YdWqVEGKmSYKbsIyDxEab",
)
print(response.secret)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.Webhooks.GetSecret(context.TODO(), "whk_YdWqVEGKmSYKbsIyDxEab")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Secret)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.webhooks.WebhookRetrieveSecretParams;
import com.dodopayments.api.models.webhooks.WebhookRetrieveSecretResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
WebhookRetrieveSecretResponse response = client.webhooks().retrieveSecret("whk_YdWqVEGKmSYKbsIyDxEab");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.webhooks.WebhookRetrieveSecretParams
import com.dodopayments.api.models.webhooks.WebhookRetrieveSecretResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val response: WebhookRetrieveSecretResponse = client.webhooks().retrieveSecret("whk_YdWqVEGKmSYKbsIyDxEab")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.webhooks.retrieve_secret("whk_YdWqVEGKmSYKbsIyDxEab")
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->webhooks->retrieveSecret('whk_YdWqVEGKmSYKbsIyDxEab');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Webhooks;
DodoPaymentsClient client = new();
WebhookRetrieveSecretParams parameters = new()
{
WebhookID = "whk_YdWqVEGKmSYKbsIyDxEab"
};
var response = await client.Webhooks.RetrieveSecret(parameters);
Console.WriteLine(response);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let webhook_id = "webhook_id";
let result = client
.webhooks()
.retrieve_secret()
.webhook_id(webhook_id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/webhooks/{webhook_id}/secret \
--header 'Authorization: Bearer <token>'{
"secret": "<string>"
}Lần sửa đổi cuối 1 tháng 4, 2026
Trang này có hữu ích không?
Trước
Các Quốc Gia Hỗ TrợLấy danh sách các quốc gia được Dodo Payments hỗ trợ cho khách hàng 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.webhooks.retrieveSecret('whk_YdWqVEGKmSYKbsIyDxEab');
console.log(response.secret);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.webhooks.retrieve_secret(
"whk_YdWqVEGKmSYKbsIyDxEab",
)
print(response.secret)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.Webhooks.GetSecret(context.TODO(), "whk_YdWqVEGKmSYKbsIyDxEab")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Secret)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.webhooks.WebhookRetrieveSecretParams;
import com.dodopayments.api.models.webhooks.WebhookRetrieveSecretResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
WebhookRetrieveSecretResponse response = client.webhooks().retrieveSecret("whk_YdWqVEGKmSYKbsIyDxEab");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.webhooks.WebhookRetrieveSecretParams
import com.dodopayments.api.models.webhooks.WebhookRetrieveSecretResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val response: WebhookRetrieveSecretResponse = client.webhooks().retrieveSecret("whk_YdWqVEGKmSYKbsIyDxEab")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.webhooks.retrieve_secret("whk_YdWqVEGKmSYKbsIyDxEab")
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->webhooks->retrieveSecret('whk_YdWqVEGKmSYKbsIyDxEab');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Webhooks;
DodoPaymentsClient client = new();
WebhookRetrieveSecretParams parameters = new()
{
WebhookID = "whk_YdWqVEGKmSYKbsIyDxEab"
};
var response = await client.Webhooks.RetrieveSecret(parameters);
Console.WriteLine(response);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let webhook_id = "webhook_id";
let result = client
.webhooks()
.retrieve_secret()
.webhook_id(webhook_id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/webhooks/{webhook_id}/secret \
--header 'Authorization: Bearer <token>'{
"secret": "<string>"
}