Passer au contenu principal
PATCH
/
license_keys
/
{id}
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 licenseKey = await client.licenseKeys.update('lic_7namTC0VcgrnzrF3GTSwB');

console.log(licenseKey.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
)
license_key = client.license_keys.update(
id="lic_7namTC0VcgrnzrF3GTSwB",
)
print(license_key.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"),
)
licenseKey, err := client.LicenseKeys.Update(
context.TODO(),
"lic_7namTC0VcgrnzrF3GTSwB",
dodopayments.LicenseKeyUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", licenseKey.ID)
}
package com.dodopayments.api.example;

import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.licensekeys.LicenseKey;
import com.dodopayments.api.models.licensekeys.LicenseKeyUpdateParams;

public final class Main {
private Main() {}

public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

LicenseKey licenseKey = client.licenseKeys().update("lic_7namTC0VcgrnzrF3GTSwB");
}
}
package com.dodopayments.api.example

import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.licensekeys.LicenseKey
import com.dodopayments.api.models.licensekeys.LicenseKeyUpdateParams

fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

val licenseKey: LicenseKey = client.licenseKeys().update("lic_7namTC0VcgrnzrF3GTSwB")
}
require "dodopayments"

dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)

license_key = dodo_payments.license_keys.update("lic_7namTC0VcgrnzrF3GTSwB")

puts(license_key)
<?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 {
$licenseKey = $client->licenseKeys->update(
'lic_7namTC0VcgrnzrF3GTSwB',
activationsLimit: 0,
disabled: true,
expiresAt: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
);

var_dump($licenseKey);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.LicenseKeys;

DodoPaymentsClient client = new();

LicenseKeyUpdateParams parameters = new() { ID = "lic_7namTC0VcgrnzrF3GTSwB" };

var licenseKey = await client.LicenseKeys.Update(parameters);

Console.WriteLine(licenseKey);
use dodopayments::Client;

#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let id = "id";
let result = client
.license_keys()
.update()
.id(id)
.body(Default::default())
.await?;
println!("{result:?}");
Ok(())
}
curl --request PATCH \
--url https://test.dodopayments.com/license_keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"activations_limit": 123,
"disabled": true,
"expires_at": "2023-11-07T05:31:56Z"
}
'
{
  "brand_id": "<string>",
  "business_id": "<string>",
  "created_at": "2024-01-01T00:00:00.000Z",
  "customer_id": "cus_123",
  "id": "lic_123",
  "instances_count": 123,
  "key": "<string>",
  "product_id": "<string>",
  "activations_limit": 5,
  "expires_at": "2024-12-31T23:59:59.000Z",
  "payment_id": "<string>",
  "subscription_id": "<string>"
}
API obsolète : Les clés de licence sont maintenant gérées via le système Entitlements. Configurez les limites et durées d’activation sur le droit de clé de licence, et utilisez Révoquer la concession pour désactiver la clé d’un client. Ce point de terminaison sera supprimé dans une future version.
La mise à jour d’une clé de licence via l’API ne déclenche pas de notifications par email au client.

Autorisations

Authorization
string
header
requis

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Paramètres de chemin

id
string
requis

License key ID

Corps

application/json
activations_limit
integer<int32> | null

The updated activation limit for the license key. Use null to remove the limit, or omit this field to leave it unchanged.

disabled
boolean | null

Indicates whether the license key should be disabled. A value of true disables the key, while false enables it. Omit this field to leave it unchanged.

expires_at
string<date-time> | null

The updated expiration timestamp for the license key in UTC. Use null to remove the expiration date, or omit this field to leave it unchanged.

Réponse

License key updated successfully

brand_id
string
requis

Brand id this license key belongs to

business_id
string
requis

The unique identifier of the business associated with the license key.

created_at
string<date-time>
requis

The timestamp indicating when the license key was created, in UTC.

Exemple:

"2024-01-01T00:00:00.000Z"

customer_id
string
requis

The unique identifier of the customer associated with the license key.

Exemple:

"cus_123"

id
string
requis

The unique identifier of the license key.

Exemple:

"lic_123"

instances_count
integer<int32>
requis

The current number of instances activated for this license key.

key
string
requis

The license key string.

product_id
string
requis

The unique identifier of the product associated with the license key.

source
enum<string>
requis

The source of the license key - 'auto' for keys generated by payment/subscription flows, 'import' for merchant-imported keys.

Options disponibles:
auto,
import,
manual
status
enum<string>
requis

The current status of the license key (e.g., active, inactive, expired).

Options disponibles:
active,
expired,
disabled
activations_limit
integer<int32> | null

The maximum number of activations allowed for this license key.

Exemple:

5

expires_at
string<date-time> | null

The timestamp indicating when the license key expires, in UTC.

Exemple:

"2024-12-31T23:59:59.000Z"

payment_id
string | null

The unique identifier of the payment associated with the license key, if any.

subscription_id
string | null

The unique identifier of the subscription associated with the license key, if any.

Dernière modification le 9 juin 2026