Skip to content

Create a webhook endpoint

POST
/v1/webhook-endpoints
const endpoint = await gp.webhookEndpoints.create({
url: 'https://merchant.example/webhooks/feitpay',
enabled_events: ['payment.confirmed', 'payment.review_required', 'payment.reorged'],
});
// endpoint.secret (whsec_…) is shown once — store it in your secret manager

The whsec_… signing secret is returned once. Destinations are SSRF-checked at delivery time and redirects are never followed. The URL must use HTTPS on port 443 and a public DNS host name: an IP address, a single-label, internal or reserved name (localhost, *.local, *.internal, *.lan, *.home.arpa, *.test, *.example, …), a non-ASCII name (use its punycode form), a wildcard-DNS rebinding domain (nip.io, sslip.io, …) or one of the platform’s own hosts is refused with 422 url_not_allowed. An organization has at most 10 enabled endpoints per mode (409 webhook_endpoint_limit_reached) and creates at most 30 per hour in each mode (429 rate_limited); deployments may configure other limits. Honors Idempotency-Key (replays return the original response for 24 h).

FeitPay-Organization
string

Active organization for dashboard sessions. Ignored for API keys (the key determines the organization).

FeitPay-Environment
string
default: test
Allowed values: test live

test (default) or live for dashboard sessions. API keys determine the environment. Until the platform is in production, configuration (stores, webhook endpoints, payment links) is live and money movement answers payments_not_enabled.

Idempotency-Key
string
<= 255 characters

Unique key per logical create operation (max 255 chars). Replays return the original response; reuse with a different body returns idempotency_error.

Media typeapplication/json
object
url
required
string format: uri
<= 2048 characters
description
string
<= 200 characters
enabled_events
required
Array<string>
>= 1 items
store_id
string

Example generated

{
"url": "https://example.com",
"description": "example",
"enabled_events": [
"example"
],
"store_id": "example"
}

Created; signing secret is shown once.

Media typeapplication/json
object
id
required
string
object
required
string
Allowed value: webhook_endpoint
livemode
required
boolean
url
required
string
description
required
string
enabled_events
required
Array
store_id
required
string | null
status
required
string
Allowed values: enabled disabled
secret_last4
required
string | null
secret_rotated_at
required
string | null format: date-time
created_at
required
string format: date-time
updated_at
required
string format: date-time
secret
required

Whsec_… signing secret, shown once.

string

Example

{
"object": "webhook_endpoint",
"enabled_events": [
"payment_intent.created"
],
"status": "enabled"
}

Missing or invalid credentials.

Media typeapplication/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found_error conflict_error idempotency_error rate_limit_error feature_unavailable_error api_error
code
required

Stable machine-readable reason. Known values are listed in ErrorCode; clients localize by code and show message (English) only for a code they do not know. New codes may be added at any time.

string
message
required

Human-readable explanation in English.

string
param
string
request_id
required
string

Example

{
"error": {
"type": "invalid_request_error"
}
}

Authenticated but not permitted. Any route may also answer request_blocked when abuse protection has blocked the client IP for a while.

Media typeapplication/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found_error conflict_error idempotency_error rate_limit_error feature_unavailable_error api_error
code
required

Stable machine-readable reason. Known values are listed in ErrorCode; clients localize by code and show message (English) only for a code they do not know. New codes may be added at any time.

string
message
required

Human-readable explanation in English.

string
param
string
request_id
required
string

Example

{
"error": {
"type": "invalid_request_error"
}
}

State conflict.

Media typeapplication/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found_error conflict_error idempotency_error rate_limit_error feature_unavailable_error api_error
code
required

Stable machine-readable reason. Known values are listed in ErrorCode; clients localize by code and show message (English) only for a code they do not know. New codes may be added at any time.

string
message
required

Human-readable explanation in English.

string
param
string
request_id
required
string

Example

{
"error": {
"type": "invalid_request_error"
}
}

Validation failed.

Media typeapplication/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found_error conflict_error idempotency_error rate_limit_error feature_unavailable_error api_error
code
required

Stable machine-readable reason. Known values are listed in ErrorCode; clients localize by code and show message (English) only for a code they do not know. New codes may be added at any time.

string
message
required

Human-readable explanation in English.

string
param
string
request_id
required
string

Example

{
"error": {
"type": "invalid_request_error"
}
}

Too many requests. See Retry-After.

Media typeapplication/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found_error conflict_error idempotency_error rate_limit_error feature_unavailable_error api_error
code
required

Stable machine-readable reason. Known values are listed in ErrorCode; clients localize by code and show message (English) only for a code they do not know. New codes may be added at any time.

string
message
required

Human-readable explanation in English.

string
param
string
request_id
required
string

Example

{
"error": {
"type": "invalid_request_error"
}
}
Retry-After
integer