UseePay Open API
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
  1. Webhooks
  • Integration
    • Welcome to the UseePay Demo Page
    • About Payment Methods
      • Card
      • Apple Pay Web Integration (API Integration)
      • Apple Pay(Hosted Checkout)
      • Google Pay
      • Klarna
      • Naver pay
      • Kakao Pay
      • Toss Pay
      • Payco
      • Affirm
      • Blik
      • trustly
      • Cashapp
    • subscription
      • Get started with Subscription
    • online payment
      • Get started with online payments
    • Payment Capabilities
      • Adaptive Price
      • Supported Payment Methods for Checkout
    • checkout session
      • Checkout Session Guide
  • developer
    • Introduction
    • Authentication
    • Errors
    • error code
      • last_payment_error documentation
    • Best Integration
      • Quickly create a paymentIntent for a subscription
      • Auto-Charge Subscription Guide
    • Payment Intents
      • Payment Intent Overview
      • Quickly create a paymentIntent
      • Create a PaymentIntent
      • Retrieve a PaymentIntent
      • Update a PaymentIntent
      • Confirm a PaymentIntent
      • Cancel a PaymentIntent
      • Capture a PaymentIntent
      • List all payment intents
    • Customers
      • Create a customer
      • Retrieves a customer
      • Update a customer
      • List all customers
    • Subscriptions
      • Create a subscription
      • Retrieves a subscription
      • Update a subscription
      • List all subscriptions
      • Cancel a subscription
    • Invoices
      • Create a invoice
      • Retrieves a invoice
      • List all invoices
      • Pay a invoice
    • Payment Methods
      • Create a payment method
      • Retieve Payment Method Session
      • Retrieves a payment method
      • Update a payment method
      • List all payment methods
    • Mandates
      • Create a mandate
      • Retrieves a mandate
      • List all mandates
    • Refunds
      • Create a refund
      • Retrieves a refund
      • List all refunds
    • Webhooks
      • Webhook events
      • Webhook Activation/Signature Verification Steps
      • Webhook Events Documentation (testing)
      • Create a webhook
        POST
      • Retrieves a webhook
        GET
      • Update a webhook
        POST
      • List all webhooks
        GET
    • Embedded Checkout
      • Payment Elements
      • Express Checkout Elements
      • Checkout Session Element
    • case
    • objects
    • About Testing
      • Test Cards
      • ApplePay&GooglePay
    • Payment Method Configuration
      • Retieve Payment Method Configuration
    • Checkout Session
      • Create Checkout Session
      • Retrieve Checkout Session
    • Trackers
      • upload trackers
      • Retrieve a tracker
    • Schemas
      • CheckoutSessionCreateRequest
      • LineItem
      • Customer
      • Address
      • ProductData
      • Shipping
      • SubscriptionData
      • Error
      • DiscountPeriodConfig
      • DeviceData
      • CheckoutSessionResponse
      • ErrorResponse
      • Order
      • Product
      • PaymentMethodOptions
      • RiskControlOptions
      • Mandate
      • PaymentIntent
      • PaymentMethod
      • Billing
      • Card
      • AliPay
      • Wallet
      • Klarna
      • WechatPay
      • Refund
      • Subscription
      • Recurring
      • PriceData
      • SubscriptionItem
      • Invoice
      • NextAction
      • Webhook
      • CollectableOptions
      • PaymentLink
      • last_payment_error
      • discount_period_config
      • CreatePaymentIntentRequest
  • message
    • Messaging Element
  • FAQ
    • Unable to receive Webhook notifications
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
  1. Webhooks

Webhook Events Documentation (testing)

Webhook Events Documentation#

Overview#

UseePay sends webhook event notifications to your configured server when specific business events occur (such as successful payments, subscription creation, etc.). All webhook notifications use a unified JSON data format and are pushed to your configured webhook URL via HTTP POST requests.
Through webhooks, you can receive real-time notifications of payment status changes, subscription updates, and other important business events without the need for active polling, improving system integration efficiency.

Webhook Message Format#

HTTP Request Format#

UseePay sends webhooks as HTTP POST requests with form-data format:
POST /your-webhook-endpoint 
Host: merchant.example.com
Content-Type: application/x-www-form-urlencoded

data={...business object JSON...}

Webhook Data Structure#

The data parameter contains a JSON string with the business object data. The structure varies depending on the event type:
For Payment Intent Events:
{
  "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": {}
}
For Subscription Events:
{
  "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"
}
For Invoice Events:
{
  "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"
}

Common Fields#

All business objects contain these common fields:
FieldTypeDescription
idStringUnique identifier for the object
objectStringObject type (e.g., "payment_intent", "subscription", "invoice")
statusStringCurrent status of the object
created_atStringCreation timestamp in ISO 8601 format

Delivery Mechanism#

1.
Asynchronous Delivery: Events are sent asynchronously without blocking your business operations
2.
Retry Logic: Failed deliveries will be automatically retried
3.
Guaranteed Delivery: We ensure reliable delivery of all webhook events

Supported Webhook Event Types#

1. Payment Intent Events#

Event NameTrigger ConditionDescription
payment_intent.createdWhen a payment intent is createdA payment intent has been created.
payment_intent.requires_payment_methodWhen payment method is requiredThis payment intent requires payment method to proceed.
payment_intent.requires_captureWhen merchant capture is requiredMerchant capture is required to fulfill this payment intent.
payment_intent.requires_customer_actionWhen customer action is neededAdditional customer action is required to fulfill this payment intent.
payment_intent.pendingWhen payment is processingThe payment request has been accepted. Waiting for the final result.
payment_intent.succeededWhen payment succeedsA payment intent has been fulfilled.
payment_intent.cancelledWhen payment is cancelledThe payment intent has been cancelled.
payment_intent.failedWhen payment failsThe payment intent has been failed.
Data Object Type: PaymentIntent

2. Subscription Events#

Event NameTrigger ConditionDescription
subscription.createdWhen subscription is created (incomplete status)A subscription has been created.
subscription.activeWhen subscription becomes activeThis subscription is active.
subscription.updatedWhen subscription is updatedThe subscription has been changed, such as status update, trial start & end, cancel at period end, etc.
subscription.unpaidWhen subscription is unpaidThis subscription is unpaid.
subscription.pausedWhen subscription is pausedThis subscription has paused.
subscription.cancelledWhen subscription is cancelledThe subscription has been cancelled.
subscription.expiredWhen subscription expiresThis subscription has expired.
Data Object Type: Subscription

3. Invoice Events#

Event NameTrigger ConditionDescription
invoice.sentWhen invoice is created (open status)The invoice is ready to be paid.
invoice.paidWhen invoice payment succeedsThe invoice has been paid successfully.
invoice.payment_failedWhen invoice payment failsThe invoice is marked as PAYMENT_FAILED and should be treated as bad debt in the accounting process.
invoice.cancelledWhen invoice is cancelledThe invoice is cancelled.
Data Object Type: Invoice

4. Refund Events#

Event NameTrigger ConditionDescription
refund.receivedWhen refund request is receivedThis refund request has been received and will be processed later.
refund.acceptedWhen refund request is acceptedThis 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.succeededWhen refund succeedsThis refund has been fulfilled successfully.
refund.failedWhen refund failsThis refund has failed.
Data Object Type: Refund

5. Checkout Session Events#

Event NameTrigger ConditionDescription
checkout_session.completedWhen checkout session completesA checkout session has been completed successfully.
checkout_session.expiredWhen checkout session expiresA checkout session has expired without being completed.

Event Trigger Flow#

Business Event Occurs
    ↓
UseePay System Detects Status Change
    ↓
Webhook Event Generated
    ↓
HTTP POST to Your Webhook URL
    ↓
Your Server Processes Event

Best Practices for Receiving Webhooks#

1. Verify Signatures#

You should verify the signature of webhook requests to ensure they originate from UseePay.

2. Idempotency Handling#

The same event may be sent multiple times. Use event.id for idempotency handling.

3. Quick Response#

Your webhook endpoint should respond quickly with HTTP 200 to avoid timeouts. Process business logic asynchronously.

4. Error Handling#

When you return a non-2xx status code, UseePay will retry the webhook delivery.

5. Security Considerations#

Use HTTPS for your webhook URL
Validate the webhook signature
Implement rate limiting
Log all webhook events for debugging

Examples#

How to Receive Webhooks#

HTTP Request Example:
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":{}}
Parsing Example (Node.js/Express):
Parsing Example (Python/Flask):
Parsing Example (Java/Spring Boot):

Payment Intent Success Event#

Webhook Data (PaymentIntent object):
{
  "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": {}
}

Subscription Active Event#

Webhook Data (Subscription object):
{
  "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": {}
}

Invoice Paid Event#

Webhook Data (Invoice object):
{
  "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": {}
}

Checkout Session Completed Event#

Webhook Data (CheckoutSession object):
{
  "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": {}
}

Testing Webhooks#

Test Mode#

UseePay provides a test mode where you can trigger webhook events without processing real payments.

Webhook Logs#

You can view webhook delivery logs in your UseePay dashboard, including:
Event type
Delivery status
Response code
Retry attempts
Timestamp

Troubleshooting#

Common Issues#

Q1: Why am I not receiving webhooks?
Possible reasons:
1.
Webhook URL not configured
2.
Webhook URL is not accessible
3.
Firewall blocking incoming requests
4.
SSL certificate issues (if using HTTPS)
Solutions:
Verify your webhook URL configuration
Test your endpoint with tools like curl or Postman
Check firewall settings
Ensure valid SSL certificate
Q2: How to handle duplicate events?
Use the event.id field for idempotency. Store processed event IDs and skip events that have already been processed.
Q3: What happens if my webhook endpoint is down?
UseePay will retry failed webhook deliveries according to the retry schedule. You can view failed deliveries in your dashboard.
Q4: How long does UseePay retry failed webhooks?
Webhooks are retried with exponential backoff for up to 3 days.

Event Summary Table#

CategoryEvent CountEvents
Payment Intent8created, requires_payment_method, requires_capture, requires_customer_action, pending, succeeded, cancelled, failed
Subscription7created, active, updated, unpaid, paused, cancelled, expired
Invoice4sent, paid, payment_failed, cancelled
Refund4received, accepted, succeeded, failed
Checkout Session2completed, expired
Payment Method2created, updated
Total27

Support#

If you have questions about webhooks or need assistance with integration:
Email: support@useepay.com
Modified at 2026-01-27 09:00:28
Previous
Webhook Activation/Signature Verification Steps
Next
Create a webhook
Built with