Skip to main content
This guide walks you through a complete payment flow using the Taliup PHP SDK. By the end you’ll have installed the SDK, initialised the client with your credentials, generated a hosted checkout URL, redirected a customer, and handled the webhook Taliup fires once their payment is captured.
1

Install the SDK

Add the SDK to your project with Composer:
The SDK requires PHP 8.2+. Guzzle is pulled in automatically as a dependency — there are no other manual steps.
2

Get your credentials

Log in to your Taliup dashboard and navigate to Taliup → Settings → Payments → Credentials.You need two values:
Store both values as environment variables (e.g. in a .env file) rather than hard-coding them in source files. The examples below use getenv() to follow that practice.
3

Initialise the client

Load the Composer autoloader and create a Client instance with your credentials:
The base_url defaults to https://taliuphq.com/api/v1 and the HTTP timeout defaults to 10 seconds — you can override either if needed:
The constructor throws Taliup\Sdk\Exceptions\ApiException immediately if either required credential is empty, so misconfiguration surfaces at boot time rather than at the first API call.
4

Create a checkout URL and redirect the customer

Call createCheckoutUrl() with the details of the order, then redirect the customer to the returned URL:
redirect_url, cancel_url, and webhook_url must all use HTTPS. Plain HTTP URLs are rejected by the API.
5

Handle the webhook after payment

After a payment is captured, Taliup sends a POST request to your webhook_url with a JSON body and an X-Taliup-Signature header. Always verify the signature before acting on the event.
Webhook::constructEvent() verifies the HMAC-SHA256 signature and decodes the JSON body in one call, throwing ApiException if the signature is invalid. If you only need a quick boolean guard, use Webhook::verify() instead:
A successful payment.captured event looks like this:
6

Verify the transaction server-side (optional)

In addition to webhook events, you can confirm a completed transaction programmatically using the token returned by createCheckoutUrl(). This is useful as a fallback or for server-to-server confirmation flows.
verifyTransaction() is a server-side check against the Taliup API. Use it alongside — not as a replacement for — webhook verification.

What’s next?

Introduction

Explore the full public API surface — every method, parameter, and error type documented in one place.