Skip to main content
POST
/
webhooks
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 webhookDetails = await client.webhooks.create({ url: 'url' });

console.log(webhookDetails.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
)
webhook_details = client.webhooks.create(
url="url",
)
print(webhook_details.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"),
)
webhookDetails, err := client.Webhooks.New(context.TODO(), dodopayments.WebhookNewParams{
URL: dodopayments.F("url"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", webhookDetails.ID)
}
package com.dodopayments.api.example;

import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.webhooks.WebhookCreateParams;
import com.dodopayments.api.models.webhooks.WebhookDetails;

public final class Main {
private Main() {}

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

WebhookCreateParams params = WebhookCreateParams.builder()
.url("url")
.build();
WebhookDetails webhookDetails = client.webhooks().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.webhooks.WebhookCreateParams
import com.dodopayments.api.models.webhooks.WebhookDetails

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

val params: WebhookCreateParams = WebhookCreateParams.builder()
.url("url")
.build()
val webhookDetails: WebhookDetails = client.webhooks().create(params)
}
require "dodopayments"

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

webhook_details = dodo_payments.webhooks.create(url: "url")

puts(webhook_details)
<?php

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

use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
use Dodopayments\WebhookEvents\WebhookEventType;

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

try {
$webhookDetails = $client->webhooks->create(
url: 'url',
description: 'description',
disabled: true,
filterTypes: [WebhookEventType::PAYMENT_SUCCEEDED],
headers: ['foo' => 'string'],
idempotencyKey: 'idempotency_key',
metadata: ['foo' => 'string'],
rateLimit: 0,
);

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

DodoPaymentsClient client = new();

WebhookCreateParams parameters = new() { UrlValue = "url" };

var webhookDetails = await client.Webhooks.Create(parameters);

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

#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.webhooks()
.create()
.body(dodopayments::models::WebhooksCreateParams {
url: Some("url".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}
curl --request POST \
--url https://test.dodopayments.com/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"description": "<string>",
"disabled": true,
"filter_types": [],
"headers": {},
"idempotency_key": "<string>",
"metadata": {},
"rate_limit": 1
}
'
{
  "created_at": "<string>",
  "description": "<string>",
  "id": "<string>",
  "metadata": {},
  "updated_at": "<string>",
  "url": "<string>",
  "disabled": true,
  "filter_types": [
    "<string>"
  ],
  "rate_limit": 1
}

Authorizations

Authorization
string
header
required

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

Body

application/json
url
string
required

Url of the webhook

description
string | null
disabled
boolean | null

Create the webhook in a disabled state.

Default is false

filter_types
enum<string>[]

Filter events to the webhook.

Webhook event will only be sent for events in the list.

Event types for Dodo events

Available options:
payment.succeeded,
payment.failed,
payment.processing,
payment.cancelled,
refund.succeeded,
refund.failed,
dispute.opened,
dispute.expired,
dispute.accepted,
dispute.cancelled,
dispute.challenged,
dispute.won,
dispute.lost,
subscription.active,
subscription.renewed,
subscription.on_hold,
subscription.paused,
subscription.cancelled,
subscription.failed,
subscription.expired,
subscription.plan_changed,
subscription.updated,
subscription.update_payment_method,
license_key.created,
payout.not_initiated,
payout.on_hold,
payout.in_progress,
payout.failed,
payout.success,
credit.added,
credit.deducted,
credit.expired,
credit.rolled_over,
credit.rollover_forfeited,
credit.overage_charged,
credit.overage_reset,
credit.manual_adjustment,
credit.balance_low,
abandoned_checkout.detected,
abandoned_checkout.recovered,
dunning.started,
dunning.recovered,
entitlement_grant.created,
entitlement_grant.delivered,
entitlement_grant.failed,
entitlement_grant.revoked
headers
object | null

Custom headers to be passed

idempotency_key
string | null

The request's idempotency key

metadata
object | null

Metadata to be passed to the webhook Defaut is {}

rate_limit
integer<int32> | null
Required range: x >= 0

Response

200 - application/json

Endpoint created Successfully

created_at
string
required

Created at timestamp

description
string
required

An example webhook name.

id
string
required

The webhook's ID.

metadata
object
required

Metadata of the webhook

updated_at
string
required

Updated at timestamp

url
string
required

Url endpoint of the webhook

disabled
boolean | null

Status of the webhook.

If true, events are not sent

filter_types
string[] | null

Filter events to the webhook.

Webhook event will only be sent for events in the list.

rate_limit
integer<int32> | null

Configured rate limit

Required range: x >= 0
Last modified on March 25, 2026