Vai al contenuto principale
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
}
Nessuna chiave API richiesta: Questo è un endpoint pubblico che non richiede autenticazione. Puoi chiamarlo direttamente da applicazioni client, software desktop o CLI per convalidare i codici di licenza senza esporre le tue credenziali API.

Corpo

application/json
license_key
string
obbligatorio
Esempio:

"2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43"

license_key_instance_id
string | null
Esempio:

"lki_123"

Risposta

License key validation result

valid
boolean
obbligatorio
Esempio:

true

Ultima modifica il 1 aprile 2026