Skip to main content

Understanding Webhooks

Webhooks are essential for confirming payments. They provide real-time notifications when payment events occur.
Important: Always use webhooks to confirm payments. Don’t rely solely on customer redirects, as customers may close their browser before returning to your site.

How Webhooks Work

1

Configure your webhook URL

Set up your webhook endpoint URL in the Payviox Dashboard
2

Payviox sends a POST request

When payment events occur, Payviox sends a POST request to your configured URL
3

Your server receives the notification

Your server endpoint receives the webhook with complete payment details
4

Verify the signature

Always verify the webhook signature to ensure it’s from Payviox and hasn’t been tampered with
5

Process the payment

Fulfill the order, send confirmation emails, update your database, etc.
6

Return 200 OK

Respond with HTTP 200 status to acknowledge receipt of the webhook

Webhook Payload Example

{
  "amount": 10000,
  "currency": "USD",
  "metadata": {
    "integration_session_id": "sess_abc123xyz"
  },
  "type": "succeeded",
  "provider": "stripe",
  "order_id": "order_123456",
  "items": [
    {
      "name": "Premium Subscription",
      "quantity": 1,
      "price": 10000
    }
  ],
  "payment_method": "card"
}
The type field indicates the payment status: succeeded, processing, canceled, requires_action, etc.

Payment States

A payment can be in one of several states during its lifecycle:
StateDescriptionAction Required
succeededPayment completed successfullyFulfill order
processingPayment is being processedWait for final status
canceledPayment was canceledCancel order
requires_actionCustomer action neededNotify customer
requires_payment_methodPayment method requiredRequest new method
requires_confirmationConfirmation neededConfirm payment

What Happens During Payment?

Your application creates a payment session by calling Payviox with:
  • Amount (in smallest currency unit, e.g., cents)
  • Currency (USD, EUR, GBP, etc.)
  • Order details (customer ID, order ID, items)
  • Payment method (card, crypto, bank transfer, etc.)
Payviox returns a session ID and secure payment URL.
The customer is redirected to Payviox’s secure payment page where:
  • Payment form is displayed with selected payment method
  • Customer enters payment details
  • Payment is processed through the appropriate provider (Stripe, PayPal, etc.)
  • Transaction is encrypted and secured
Immediately after payment processing:
  • Payviox sends a webhook POST request to your configured URL
  • Includes payment status, amount, order ID, and all details
  • This is your source of truth for payment confirmation
  • Retries automatically if your server doesn’t respond
After payment:
  • Customer is redirected back to your website
  • URL includes session ID as parameter
  • You can show a confirmation page
  • Note: Always rely on webhooks, not just redirects

Next Steps