Licenses
تفعيل الترخيص
تسمح لك هذه النقطة النهائية بتفعيل ترخيص للمستخدم.
POST
/
licenses
/
activate
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.activate({ license_key: 'license_key', name: 'name' });
console.log(response.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.licenses.activate(
license_key="license_key",
name="name",
)
print(response.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.Licenses.Activate(context.TODO(), dodopayments.LicenseActivateParams{
LicenseKey: dodopayments.F("license_key"),
Name: dodopayments.F("name"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ID)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.licenses.LicenseActivateParams;
import com.dodopayments.api.models.licenses.LicenseActivateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
LicenseActivateParams params = LicenseActivateParams.builder()
.licenseKey("license_key")
.name("name")
.build();
LicenseActivateResponse response = client.licenses().activate(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.LicenseActivateParams
import com.dodopayments.api.models.licenses.LicenseActivateResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: LicenseActivateParams = LicenseActivateParams.builder()
.licenseKey("license_key")
.name("name")
.build()
val response: LicenseActivateResponse = client.licenses().activate(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.licenses.activate(license_key: "license_key", name: "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->licenses->activate(
licenseKey: 'license_key', name: 'name'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Licenses;
DodoPaymentsClient client = new();
LicenseActivateParams parameters = new()
{
LicenseKey = "license_key",
Name = "name",
};
var response = await client.Licenses.Activate(parameters);
Console.WriteLine(response);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.licenses()
.activate()
.body(dodopayments::models::LicensesActivateParams {
license_key: Some("license_key".to_string()),
name: Some("name".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/licenses/activate \
--header 'Content-Type: application/json' \
--data '
{
"license_key": "<string>",
"name": "<string>"
}
'{
"business_id": "<string>",
"created_at": "2024-01-01T00:00:00.000Z",
"customer": {
"customer_id": "<string>",
"email": "<string>",
"name": "<string>",
"metadata": {},
"phone_number": "<string>"
},
"id": "lki_123",
"license_key_id": "lic_123",
"name": "Production Server 1",
"product": {
"product_id": "<string>",
"name": "<string>"
}
}لا حاجة لمفتاح API: هذا هو نقطة نهاية عامة لا تتطلب مصادقة. يمكنك الاتصال بها مباشرة من تطبيقات العميل أو برامج سطح المكتب أو أدوات CLI لتنشيط مفاتيح الرخص دون الكشف عن بيانات اعتماد API الخاصة بك.
الاستجابة
License key instance created
Business ID
Creation timestamp
مثال:
"2024-01-01T00:00:00.000Z"
Limited customer details associated with the license key.
Show child attributes
Show child attributes
License key instance ID
مثال:
"lki_123"
Associated license key ID
مثال:
"lic_123"
Instance name
مثال:
"Production Server 1"
Related product info. Present if the license key is tied to a product.
Show child attributes
Show child attributes
آخر تعديل في ١ أبريل ٢٠٢٦
هل كانت هذه الصفحة مفيدة؟
⌘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.activate({ license_key: 'license_key', name: 'name' });
console.log(response.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.licenses.activate(
license_key="license_key",
name="name",
)
print(response.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.Licenses.Activate(context.TODO(), dodopayments.LicenseActivateParams{
LicenseKey: dodopayments.F("license_key"),
Name: dodopayments.F("name"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ID)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.licenses.LicenseActivateParams;
import com.dodopayments.api.models.licenses.LicenseActivateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
LicenseActivateParams params = LicenseActivateParams.builder()
.licenseKey("license_key")
.name("name")
.build();
LicenseActivateResponse response = client.licenses().activate(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.LicenseActivateParams
import com.dodopayments.api.models.licenses.LicenseActivateResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: LicenseActivateParams = LicenseActivateParams.builder()
.licenseKey("license_key")
.name("name")
.build()
val response: LicenseActivateResponse = client.licenses().activate(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.licenses.activate(license_key: "license_key", name: "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->licenses->activate(
licenseKey: 'license_key', name: 'name'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Licenses;
DodoPaymentsClient client = new();
LicenseActivateParams parameters = new()
{
LicenseKey = "license_key",
Name = "name",
};
var response = await client.Licenses.Activate(parameters);
Console.WriteLine(response);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.licenses()
.activate()
.body(dodopayments::models::LicensesActivateParams {
license_key: Some("license_key".to_string()),
name: Some("name".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/licenses/activate \
--header 'Content-Type: application/json' \
--data '
{
"license_key": "<string>",
"name": "<string>"
}
'{
"business_id": "<string>",
"created_at": "2024-01-01T00:00:00.000Z",
"customer": {
"customer_id": "<string>",
"email": "<string>",
"name": "<string>",
"metadata": {},
"phone_number": "<string>"
},
"id": "lki_123",
"license_key_id": "lic_123",
"name": "Production Server 1",
"product": {
"product_id": "<string>",
"name": "<string>"
}
}