POST /your-webhook-endpoint
Host: merchant.example.com
Content-Type: application/x-www-form-urlencoded
data={...business object JSON...}data parameter contains a JSON string with the business object data. The structure varies depending on the event type:{
"id": "pi_1234567890",
"object": "payment_intent",
"amount": 10000,
"currency": "USD",
"status": "succeeded",
"customer_id": "cus_abc123",
"payment_method": {...},
"created_at": "2024-01-27T10:30:00Z",
"metadata": {}
}{
"id": "sub_9876543210",
"object": "subscription",
"status": "active",
"customer_id": "cus_abc123",
"current_period_start": "2024-01-27T00:00:00Z",
"current_period_end": "2024-02-27T00:00:00Z",
"recurring": {...},
"created_at": "2024-01-27T10:30:00Z"
}{
"id": "inv_1122334455",
"object": "invoice",
"status": "paid",
"customer_id": "cus_abc123",
"subscription_id": "sub_9876543210",
"total_amount": 9900,
"currency": "USD",
"created_at": "2024-01-27T10:30:00Z"
}| Field | Type | Description |
|---|---|---|
id | String | Unique identifier for the object |
object | String | Object type (e.g., "payment_intent", "subscription", "invoice") |
status | String | Current status of the object |
created_at | String | Creation timestamp in ISO 8601 format |
| Event Name | Trigger Condition | Description |
|---|---|---|
payment_intent.created | When a payment intent is created | A payment intent has been created. |
payment_intent.requires_payment_method | When payment method is required | This payment intent requires payment method to proceed. |
payment_intent.requires_capture | When merchant capture is required | Merchant capture is required to fulfill this payment intent. |
payment_intent.requires_customer_action | When customer action is needed | Additional customer action is required to fulfill this payment intent. |
payment_intent.pending | When payment is processing | The payment request has been accepted. Waiting for the final result. |
payment_intent.succeeded | When payment succeeds | A payment intent has been fulfilled. |
payment_intent.cancelled | When payment is cancelled | The payment intent has been cancelled. |
payment_intent.failed | When payment fails | The payment intent has been failed. |
PaymentIntent| Event Name | Trigger Condition | Description |
|---|---|---|
subscription.created | When subscription is created (incomplete status) | A subscription has been created. |
subscription.active | When subscription becomes active | This subscription is active. |
subscription.updated | When subscription is updated | The subscription has been changed, such as status update, trial start & end, cancel at period end, etc. |
subscription.unpaid | When subscription is unpaid | This subscription is unpaid. |
subscription.paused | When subscription is paused | This subscription has paused. |
subscription.cancelled | When subscription is cancelled | The subscription has been cancelled. |
subscription.expired | When subscription expires | This subscription has expired. |
Subscription| Event Name | Trigger Condition | Description |
|---|---|---|
invoice.sent | When invoice is created (open status) | The invoice is ready to be paid. |
invoice.paid | When invoice payment succeeds | The invoice has been paid successfully. |
invoice.payment_failed | When invoice payment fails | The invoice is marked as PAYMENT_FAILED and should be treated as bad debt in the accounting process. |
invoice.cancelled | When invoice is cancelled | The invoice is cancelled. |
Invoice| Event Name | Trigger Condition | Description |
|---|---|---|
refund.received | When refund request is received | This refund request has been received and will be processed later. |
refund.accepted | When refund request is accepted | This refund request has been accepted and started processing. Please note, the final fund settlement time will depend on the bank or the payment method's processing time. |
refund.succeeded | When refund succeeds | This refund has been fulfilled successfully. |
refund.failed | When refund fails | This refund has failed. |
Refund| Event Name | Trigger Condition | Description |
|---|---|---|
checkout_session.completed | When checkout session completes | A checkout session has been completed successfully. |
checkout_session.expired | When checkout session expires | A checkout session has expired without being completed. |
Business Event Occurs
↓
UseePay System Detects Status Change
↓
Webhook Event Generated
↓
HTTP POST to Your Webhook URL
↓
Your Server Processes Eventevent.id for idempotency handling.POST /webhook HTTP/1.1
Host: merchant.example.com
Content-Type: application/x-www-form-urlencoded
data={"id":"pi_1234567890","object":"payment_intent","amount":10000,"currency":"USD","status":"succeeded","customer_id":"cus_abc123","payment_method":{"type":"card","card":{"brand":"visa","last4":"4242"}},"created_at":"2024-01-27T10:30:00Z","metadata":{}}{
"id": "pi_1234567890",
"object": "payment_intent",
"amount": 10000,
"currency": "USD",
"status": "succeeded",
"customer_id": "cus_abc123",
"payment_method": {
"type": "card",
"card": {
"brand": "visa",
"last4": "4242"
}
},
"created_at": "2024-01-27T10:30:00Z",
"metadata": {}
}{
"id": "sub_9876543210",
"object": "subscription",
"status": "active",
"customer_id": "cus_abc123",
"current_period_start": "2024-01-27T00:00:00Z",
"current_period_end": "2024-02-27T00:00:00Z",
"recurring": {
"interval": "month",
"interval_count": 1,
"unit_amount": 9900
},
"created_at": "2024-01-27T10:30:00Z",
"metadata": {}
}{
"id": "inv_1122334455",
"object": "invoice",
"status": "paid",
"customer_id": "cus_abc123",
"subscription_id": "sub_9876543210",
"total_amount": 9900,
"currency": "USD",
"period_start": "2024-01-27T00:00:00Z",
"period_end": "2024-02-27T00:00:00Z",
"payment_intent_id": "pi_1234567890",
"created_at": "2024-01-27T10:30:00Z",
"metadata": {}
}{
"id": "cs_6677889900",
"object": "checkout.session",
"mode": "subscription",
"status": "complete",
"payment_status": "paid",
"customer_id": "cus_abc123",
"subscription_id": "sub_9876543210",
"payment_intent_id": "pi_1234567890",
"amount": 9900,
"currency": "USD",
"created_at": "2024-01-27T10:30:00Z",
"metadata": {}
}event.id field for idempotency. Store processed event IDs and skip events that have already been processed.| Category | Event Count | Events |
|---|---|---|
| Payment Intent | 8 | created, requires_payment_method, requires_capture, requires_customer_action, pending, succeeded, cancelled, failed |
| Subscription | 7 | created, active, updated, unpaid, paused, cancelled, expired |
| Invoice | 4 | sent, paid, payment_failed, cancelled |
| Refund | 4 | received, accepted, succeeded, failed |
| Checkout Session | 2 | completed, expired |
| Payment Method | 2 | created, updated |
| Total | 27 |