Hoppa till huvudinnehåll
POST
/
entitlements
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 entitlement = await client.entitlements.create({
  integration_config: { feature_id: 'feature_id', feature_type: 'boolean' },
  integration_type: 'discord',
  name: 'name',
});

console.log(entitlement.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
)
entitlement = client.entitlements.create(
    integration_config={
        "feature_id": "feature_id",
        "feature_type": "boolean",
    },
    integration_type="discord",
    name="name",
)
print(entitlement.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"),
	)
	entitlement, err := client.Entitlements.New(context.TODO(), dodopayments.EntitlementNewParams{
		IntegrationConfig: dodopayments.F[dodopayments.IntegrationConfigUnionParam](dodopayments.IntegrationConfigFeatureFlagConfigParam{
			FeatureID:   dodopayments.F("feature_id"),
			FeatureType: dodopayments.F(dodopayments.FeatureTypeBoolean),
		}),
		IntegrationType: dodopayments.F(dodopayments.EntitlementIntegrationTypeDiscord),
		Name:            dodopayments.F("name"),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", entitlement.ID)
}
package com.dodopayments.api.example;

import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.entitlements.Entitlement;
import com.dodopayments.api.models.entitlements.EntitlementCreateParams;
import com.dodopayments.api.models.entitlements.EntitlementIntegrationType;
import com.dodopayments.api.models.entitlements.FeatureType;
import com.dodopayments.api.models.entitlements.IntegrationConfig;

public final class Main {
    private Main() {}

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

        EntitlementCreateParams params = EntitlementCreateParams.builder()
            .integrationConfig(IntegrationConfig.FeatureFlagConfig.builder()
                .featureId("feature_id")
                .featureType(FeatureType.BOOLEAN)
                .build())
            .integrationType(EntitlementIntegrationType.DISCORD)
            .name("name")
            .build();
        Entitlement entitlement = client.entitlements().create(params);
    }
}
package com.dodopayments.api.example

import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.entitlements.Entitlement
import com.dodopayments.api.models.entitlements.EntitlementCreateParams
import com.dodopayments.api.models.entitlements.EntitlementIntegrationType
import com.dodopayments.api.models.entitlements.FeatureType
import com.dodopayments.api.models.entitlements.IntegrationConfig

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

    val params: EntitlementCreateParams = EntitlementCreateParams.builder()
        .integrationConfig(IntegrationConfig.FeatureFlagConfig.builder()
            .featureId("feature_id")
            .featureType(FeatureType.BOOLEAN)
            .build())
        .integrationType(EntitlementIntegrationType.DISCORD)
        .name("name")
        .build()
    val entitlement: Entitlement = client.entitlements().create(params)
}
require "dodopayments"

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

entitlement = dodo_payments.entitlements.create(
  integration_config: {feature_id: "feature_id", feature_type: :boolean},
  integration_type: :discord,
  name: "name"
)

puts(entitlement)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
use Dodopayments\Entitlements\FeatureType;
use Dodopayments\Entitlements\EntitlementIntegrationType;

$client = new Client(
  bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
  environment: 'test_mode',
);

try {
  $entitlement = $client->entitlements->create(
    integrationConfig: [
      'featureID' => 'feature_id', 'featureType' => FeatureType::BOOLEAN
    ],
    integrationType: EntitlementIntegrationType::DISCORD,
    name: 'name',
    description: 'description',
    metadata: ['foo' => 'string'],
  );

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

DodoPaymentsClient client = new();

EntitlementCreateParams parameters = new()
{
    IntegrationConfig = new FeatureFlagConfig()
    {
        FeatureID = "feature_id",
        FeatureType = FeatureType.Boolean,
    },
    IntegrationType = EntitlementIntegrationType.Discord,
    Name = "name",
};

var entitlement = await client.Entitlements.Create(parameters);

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

#[tokio::main]
async fn main() -> dodopayments::Result<()> {
    let client = Client::from_env()?;
    let result = client
        .entitlements()
        .create()
        .body(dodopayments::models::EntitlementsCreateParams {
                integration_config: Some(Box::new(dodopayments::models::IntegrationConfig::Variant0(serde_json::json!({"feature_id":"feature_id","feature_type":"boolean"})))),
                integration_type: Some(Box::new(dodopayments::models::EntitlementIntegrationType::Discord)),
                name: Some("name".to_string()),
                ..Default::default()
            })
        .await?;
    println!("{result:?}");
    Ok(())
}
curl --request POST \
  --url https://test.dodopayments.com/entitlements \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "integration_config": {
    "feature_id": "<string>",
    "feature_type": "boolean"
  },
  "name": "<string>",
  "description": "<string>",
  "metadata": {}
}
'
{
  "business_id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "integration_config": {
    "feature_id": "<string>",
    "feature_type": "boolean"
  },
  "is_active": true,
  "metadata": {},
  "name": "<string>",
  "updated_at": "2023-11-07T05:31:56Z",
  "description": "<string>"
}

Auktoriseringar

Authorization
string
header
obligatorisk

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

Kropp

application/json
integration_config
Feature Flag Config · object
obligatorisk

Platform-specific configuration (validated per integration_type)

integration_type
enum<string>
obligatorisk

Which platform integration this entitlement uses

Tillgängliga alternativ:
discord,
telegram,
github,
figma,
framer,
notion,
digital_files,
license_key,
feature_flag
name
string
obligatorisk

Display name for this entitlement

description
string | null

Optional description

metadata
Metadata · object

Additional metadata for the entitlement

Svar

Detailed view of a single entitlement: identity, integration type, integration-specific configuration, and metadata.

business_id
string
obligatorisk

Identifier of the business that owns this entitlement.

created_at
string<date-time>
obligatorisk

Timestamp when the entitlement was created.

id
string
obligatorisk

Unique identifier of the entitlement.

integration_config
Feature Flag Config · object
obligatorisk

Integration-specific configuration. For digital_files entitlements this includes presigned download URLs for each attached file.

integration_type
enum<string>
obligatorisk

Platform integration this entitlement uses.

Tillgängliga alternativ:
discord,
telegram,
github,
figma,
framer,
notion,
digital_files,
license_key,
feature_flag
is_active
boolean
obligatorisk

Always true for entitlements returned by the public API; soft-deleted entitlements are not returned.

metadata
Metadata · object
obligatorisk

Arbitrary key-value metadata supplied at creation or via PATCH.

name
string
obligatorisk

Display name supplied at creation.

updated_at
string<date-time>
obligatorisk

Timestamp when the entitlement was last modified.

description
string | null

Optional description supplied at creation.

Senast ändrad 28 maj 2026