Chuyển đến nội dung chính
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);
{
  "created_at": "<string>",
  "description": "<string>",
  "id": "<string>",
  "metadata": {},
  "updated_at": "<string>",
  "url": "<string>",
  "disabled": true,
  "filter_types": [
    "<string>"
  ],
  "rate_limit": 1
}

Ủy quyền

Authorization
string
header
bắt buộc

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

Nội dung

application/json
url
string
bắt buộc

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

Tùy chọn có sẵn:
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.cancelled,
subscription.failed,
subscription.expired,
subscription.plan_changed,
subscription.updated,
license_key.created
headers
object

Custom headers to be passed

idempotency_key
string | null

The request's idempotency key

metadata
object

Metadata to be passed to the webhook Defaut is {}

rate_limit
integer<int32> | null
Phạm vi bắt buộc: x >= 0

Phản hồi

200 - application/json

Endpoint created Successfully

created_at
string
bắt buộc

Created at timestamp

description
string
bắt buộc

An example webhook name.

id
string
bắt buộc

The webhook's ID.

metadata
object
bắt buộc

Metadata of the webhook

updated_at
string
bắt buộc

Updated at timestamp

url
string
bắt buộc

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

Phạm vi bắt buộc: x >= 0