Chuyển đến nội dung chính
POST
/
api
/
v1
/
webhooks
Create Webhook
curl --request POST \
  --url https://api.agentwallex.com/api/v1/webhooks \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "url": "https://your-app.com/webhooks/agentwallex",
  "events": [
    "payment.completed",
    "payment.failed",
    "policy.violated"
  ],
  "secret": "whsec_your_signing_secret"
}
'
{
  "id": "whk_abc123",
  "url": "https://your-app.com/webhooks/agentwallex",
  "events": [
    "payment.completed",
    "payment.failed",
    "policy.violated"
  ],
  "status": "active",
  "created_at": "2025-06-01T10:00:00Z"
}
Đăng ký endpoint Webhook mới để nhận thông báo sự kiện theo thời gian thực qua HTTP POST.

Nội dung yêu cầu

url
string
bắt buộc
URL HTTPS sẽ nhận các sự kiện Webhook.
events
string[]
bắt buộc
Danh sách loại sự kiện cần đăng ký. Xem Webhooks để biết các loại sự kiện có sẵn.
secret
string
bắt buộc
Khóa ký để xác minh payload Webhook. Phải bắt đầu bằng whsec_.

Ví dụ

curl -X POST https://api.agentwallex.com/api/v1/webhooks \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks/agentwallex",
    "events": ["payment.completed", "payment.failed", "policy.violated"],
    "secret": "whsec_your_signing_secret"
  }'
Response
{
  "id": "whk_abc123",
  "url": "https://your-app.com/webhooks/agentwallex",
  "events": ["payment.completed", "payment.failed", "policy.violated"],
  "status": "active",
  "created_at": "2025-06-01T10:00:00Z"
}

Ủy quyền

X-API-Key
string
header
bắt buộc

API key authentication. Keys are prefixed with awx_.

Nội dung

application/json
url
string<uri>
bắt buộc

The HTTPS URL that will receive webhook events.

events
string[]
bắt buộc

List of event types to subscribe to (e.g., payment.completed, payment.failed, policy.violated).

secret
string
bắt buộc

Signing secret used to verify webhook payloads. Must start with whsec_.

Phản hồi

Webhook created successfully.

A registered webhook endpoint for receiving real-time event notifications.

id
string

Unique webhook identifier (e.g., whk_abc123).

url
string<uri>

HTTPS URL that receives webhook events.

events
string[]

List of subscribed event types.

status
enum<string>

Webhook status.

Tùy chọn có sẵn:
active,
inactive
created_at
string<date-time>

ISO 8601 creation timestamp.