Products
Create Short Link
Creates a short checkout URL with a custom slug for a product. Uses a Static Checkout URL under the hood.
POST
/
products
/
{id}
/
short_links
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 shortLink = await client.products.shortLinks.create('pdt_R8AWMPiV8RyJElcCKvAID', {
slug: 'slug',
});
console.log(shortLink.full_url);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
)
short_link = client.products.short_links.create(
id="pdt_R8AWMPiV8RyJElcCKvAID",
slug="slug",
)
print(short_link.full_url)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"),
)
shortLink, err := client.Products.ShortLinks.New(
context.TODO(),
"pdt_R8AWMPiV8RyJElcCKvAID",
dodopayments.ProductShortLinkNewParams{
Slug: dodopayments.F("slug"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", shortLink.FullURL)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.products.shortlinks.ShortLinkCreateParams;
import com.dodopayments.api.models.products.shortlinks.ShortLinkCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ShortLinkCreateParams params = ShortLinkCreateParams.builder()
.id("pdt_R8AWMPiV8RyJElcCKvAID")
.slug("slug")
.build();
ShortLinkCreateResponse shortLink = client.products().shortLinks().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.products.shortlinks.ShortLinkCreateParams
import com.dodopayments.api.models.products.shortlinks.ShortLinkCreateResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: ShortLinkCreateParams = ShortLinkCreateParams.builder()
.id("pdt_R8AWMPiV8RyJElcCKvAID")
.slug("slug")
.build()
val shortLink: ShortLinkCreateResponse = client.products().shortLinks().create(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
short_link = dodo_payments.products.short_links.create("pdt_R8AWMPiV8RyJElcCKvAID", slug: "slug")
puts(short_link)<?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 {
$shortLink = $client->products->shortLinks->create(
'pdt_R8AWMPiV8RyJElcCKvAID',
slug: 'slug',
staticCheckoutParams: ['foo' => 'string'],
);
var_dump($shortLink);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Products.ShortLinks;
DodoPaymentsClient client = new();
ShortLinkCreateParams parameters = new()
{
ID = "pdt_R8AWMPiV8RyJElcCKvAID",
Slug = "slug",
};
var shortLink = await client.Products.ShortLinks.Create(parameters);
Console.WriteLine(shortLink);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let id = "id";
let result = client
.products()
.short_links()
.create()
.id(id)
.body(dodopayments::models::ProductsShortLinksCreateParams {
slug: Some("slug".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/products/{id}/short_links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"slug": "<string>",
"static_checkout_params": {}
}
'{
"full_url": "<string>",
"short_url": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Product Id
Body
application/json
Last modified on March 25, 2026
Was this page helpful?
⌘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 shortLink = await client.products.shortLinks.create('pdt_R8AWMPiV8RyJElcCKvAID', {
slug: 'slug',
});
console.log(shortLink.full_url);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
)
short_link = client.products.short_links.create(
id="pdt_R8AWMPiV8RyJElcCKvAID",
slug="slug",
)
print(short_link.full_url)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"),
)
shortLink, err := client.Products.ShortLinks.New(
context.TODO(),
"pdt_R8AWMPiV8RyJElcCKvAID",
dodopayments.ProductShortLinkNewParams{
Slug: dodopayments.F("slug"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", shortLink.FullURL)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.products.shortlinks.ShortLinkCreateParams;
import com.dodopayments.api.models.products.shortlinks.ShortLinkCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ShortLinkCreateParams params = ShortLinkCreateParams.builder()
.id("pdt_R8AWMPiV8RyJElcCKvAID")
.slug("slug")
.build();
ShortLinkCreateResponse shortLink = client.products().shortLinks().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.products.shortlinks.ShortLinkCreateParams
import com.dodopayments.api.models.products.shortlinks.ShortLinkCreateResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: ShortLinkCreateParams = ShortLinkCreateParams.builder()
.id("pdt_R8AWMPiV8RyJElcCKvAID")
.slug("slug")
.build()
val shortLink: ShortLinkCreateResponse = client.products().shortLinks().create(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
short_link = dodo_payments.products.short_links.create("pdt_R8AWMPiV8RyJElcCKvAID", slug: "slug")
puts(short_link)<?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 {
$shortLink = $client->products->shortLinks->create(
'pdt_R8AWMPiV8RyJElcCKvAID',
slug: 'slug',
staticCheckoutParams: ['foo' => 'string'],
);
var_dump($shortLink);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Products.ShortLinks;
DodoPaymentsClient client = new();
ShortLinkCreateParams parameters = new()
{
ID = "pdt_R8AWMPiV8RyJElcCKvAID",
Slug = "slug",
};
var shortLink = await client.Products.ShortLinks.Create(parameters);
Console.WriteLine(shortLink);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let id = "id";
let result = client
.products()
.short_links()
.create()
.id(id)
.body(dodopayments::models::ProductsShortLinksCreateParams {
slug: Some("slug".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/products/{id}/short_links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"slug": "<string>",
"static_checkout_params": {}
}
'{
"full_url": "<string>",
"short_url": "<string>"
}