Skip to main content
After a payment is captured, Taliup sends a POST request to the webhook_url you provided when creating the checkout session. The request contains a JSON body describing the payment outcome and an X-Taliup-Signature header you must verify before acting on the event. This guide walks you through setting up a reliable, secure webhook receiver.
Always verify the X-Taliup-Signature header before reading or processing any webhook data. Processing unverified payloads exposes your application to spoofed events and fraudulent order fulfilment.
1

Set webhook_url when creating the checkout session

Pass your HTTPS webhook endpoint as webhook_url in the createCheckoutUrl() payload. Taliup will POST the payment event to this URL after a payment is captured.
2

Create a webhook endpoint

Create a dedicated PHP file at the URL you registered as webhook_url. The endpoint must be publicly reachable over HTTPS.During local development you can expose your local server using a tunnelling tool such as ngrok:
Make your TALIUP_MERCHANT_SECRET_KEY available to the script via an environment variable — never hard-code secrets in source files.
3

Read the raw body and signature header

You must read the raw request body with file_get_contents('php://input') before any other input parsing. Reading from $_POST or calling json_decode() first will alter the body and invalidate the signature.
4

Verify the signature with Webhook::constructEvent()

Pass the raw payload, signature header, and your secret key to Webhook::constructEvent(). If verification succeeds it returns the decoded event as an associative array. If the signature does not match it throws an ApiException with status code 401.
If you only need a boolean result and prefer to handle the failure yourself, you can use Webhook::verify() instead:
constructEvent() is the recommended approach because it both verifies and decodes the payload atomically, reducing the risk of accidentally processing an unverified event.
5

Process the event

After successful verification, read the approved flag (or status field) and update your system accordingly. Use the reference field to look up the corresponding order in your database.
The reference value is the order ID you passed when creating the checkout session. Keying your lookup on reference is more reliable than matching on transaction_id, which is generated by Taliup.
6

Return 200 OK

Respond with HTTP 200 to acknowledge receipt. If Taliup does not receive a 200 response it will retry the webhook. Return the acknowledgement as early as possible — after verification and before any slow database or downstream operations if you can.

Complete webhook receiver

The following is a production-ready webhook receiver based on the official SDK example:

Webhook payload reference

Taliup sends the following JSON body on every payment.captured event: