Licenses
Xác thực Giấy phép
Điểm cuối này cho phép bạn xác thực giấy phép cho người dùng.
POST
/
licenses
/
validate
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.licenses.validate({
license_key: '2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43',
});
console.log(response.valid);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.licenses.validate(
license_key="2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43",
)
print(response.valid)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.Licenses.Validate(context.TODO(), dodopayments.LicenseValidateParams{
LicenseKey: dodopayments.F("2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Valid)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.licenses.LicenseValidateParams;
import com.dodopayments.api.models.licenses.LicenseValidateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
LicenseValidateParams params = LicenseValidateParams.builder()
.licenseKey("2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43")
.build();
LicenseValidateResponse response = client.licenses().validate(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.licenses.LicenseValidateParams
import com.dodopayments.api.models.licenses.LicenseValidateResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: LicenseValidateParams = LicenseValidateParams.builder()
.licenseKey("2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43")
.build()
val response: LicenseValidateResponse = client.licenses().validate(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.licenses.validate(license_key: "2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43")
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->licenses->validate(
licenseKey: '2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43',
licenseKeyInstanceID: 'lki_123',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Licenses;
DodoPaymentsClient client = new();
LicenseValidateParams parameters = new()
{
LicenseKey = "2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43"
};
var response = await client.Licenses.Validate(parameters);
Console.WriteLine(response);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.licenses()
.validate()
.body(dodopayments::models::LicensesValidateParams {
license_key: Some("2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/licenses/validate \
--header 'Content-Type: application/json' \
--data '
{
"license_key": "2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43",
"license_key_instance_id": "lki_123"
}
'{
"valid": true
}Không cần API Key: Đây là một endpoint công khai không yêu cầu xác thực. Bạn có thể gọi nó trực tiếp từ ứng dụng client, phần mềm máy tính để bàn hoặc CLI để xác thực các khóa giấy phép mà không làm lộ thông tin xác thực API của bạn.
Lần sửa đổi cuối 1 tháng 4, 2026
Trang này có hữu ích không?
Trước
Danh sách khóa bản quyềnLấy danh sách các khóa giấy phép liên kết với tài khoản 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.licenses.validate({
license_key: '2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43',
});
console.log(response.valid);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.licenses.validate(
license_key="2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43",
)
print(response.valid)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.Licenses.Validate(context.TODO(), dodopayments.LicenseValidateParams{
LicenseKey: dodopayments.F("2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Valid)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.licenses.LicenseValidateParams;
import com.dodopayments.api.models.licenses.LicenseValidateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
LicenseValidateParams params = LicenseValidateParams.builder()
.licenseKey("2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43")
.build();
LicenseValidateResponse response = client.licenses().validate(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.licenses.LicenseValidateParams
import com.dodopayments.api.models.licenses.LicenseValidateResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: LicenseValidateParams = LicenseValidateParams.builder()
.licenseKey("2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43")
.build()
val response: LicenseValidateResponse = client.licenses().validate(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.licenses.validate(license_key: "2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43")
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->licenses->validate(
licenseKey: '2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43',
licenseKeyInstanceID: 'lki_123',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Licenses;
DodoPaymentsClient client = new();
LicenseValidateParams parameters = new()
{
LicenseKey = "2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43"
};
var response = await client.Licenses.Validate(parameters);
Console.WriteLine(response);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.licenses()
.validate()
.body(dodopayments::models::LicensesValidateParams {
license_key: Some("2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/licenses/validate \
--header 'Content-Type: application/json' \
--data '
{
"license_key": "2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43",
"license_key_instance_id": "lki_123"
}
'{
"valid": true
}