Everything you need to integrate payment links, query transactions and receive webhooks.
Overview
Tierlock provides a lightweight API for generating secure payment links (signed tokens), fetching transaction data, and delivering server-to-server webhooks for payment events.
Primary endpoints: /api/generateLinkToken, /api/transactions, /api/transactions/:transaction_id, /api/transactions/order/:order_id
Authentication
All merchant-facing endpoints require merchant_id and merchant_secret in the request body for authentication.
Keep your merchant_secret private. For client-side flows use a signed link_key generated server-side.
Example
{
"merchant_id": "MERCHANT123",
"merchant_secret": "abcd1234secret"
}Generate Link Token
Endpoint: POST /api/generateLinkToken
Create a short-lived link_key (signed token) that the frontend can use to open a payment page without exposing secrets.
Request body
{
"merchant_id": "MERCHANT123",
"merchant_secret": "abcd1234secret",
"display_name": "Store name",
"total": 49.99,
"order_id": "ORDER-123"
}Response
{
"success": true,
"link_key": "<signed_jwt>",
"expires_in": 900,
"payment_url": "https://app.tierlock.com/invoice?link_key=<jwt>"
}Notes: the link_key should be valid for a short window (5–15 minutes) and created only server-side.
Get All Transactions
Endpoint: POST /api/transactions
Supports pagination, search, sorting and filtering. Authentication required.
Request body (filters)
{
"merchant_id": "MERCHANT123",
"merchant_secret": "abcd1234secret",
"page": 1,
"search": "john",
"status": "SUCCESS",
"sort_by": "created_at",
"sort_order": "DESC",
"start_date": "2025-10-01",
"end_date": "2025-10-27"
}Response (paged)
{
"success": true,
"pagination": {
"total": 120,
"page": 1,
"limit": 20,
"total_pages": 6
},
"data": [ /* array of transaction objects */ ]
}Transaction object
{
"transaction_id": "txn_123",
"order_id": "ORD_456",
"status": "SUCCESS",
"payment_method": "card",
"currency": "USD",
"amount": { "total": 100.00, "tip": 5.00, "fees": 2.50, "net": 97.50 },
"customer": { "id": "cus_1", "phone": "+1555..", "email": "a@b.com" },
"blockchain": { "status": "CONFIRMED", "chain": "Polygon", "transaction_hash": "0x..." },
"timestamps": { "created_at": "...", "updated_at": "..." }
}Get Transaction by Transaction ID
Endpoint: POST /api/transactions/:transaction_id
Body must include merchant_id and merchant_secret.
POST /transactions/txn_123
Body: { "merchant_id": "MERCHANT123", "merchant_secret": "..." }Get Transaction by Order ID
Endpoint: POST /api/transactions/order/:order_id
POST /transactions/order/ORDER-123
Body: { "merchant_id": "MERCHANT123", "merchant_secret": "..." }Webhooks
Tierlock supports server-to-server webhooks. Merchants must set a Webhook URL and will receive signed events.
Webhook payload
{
"event": "PAYMENT_SUCCESS",
"data": {
"event": "PAYMENT_SUCCESS",
"status": "SUCCESS",
"transaction_id": "txn_8a73f1c4b2",
"order_id": "ord_12345",
"total_amount": 150.00,
"tip": 5.00,
"currency": "USD",
"merchant_id": "merch_9c8d7e3f",
"customer": {
"phone_number": "15551234567",
"email": "customer@example.com"
},
"timestamp": "2025-10-27T12:45:22.321Z",
"environment": "production"
},
"timestamp": 1730012345
}Verify signature (Node / TypeScript)
const expected = crypto
.createHmac('sha256', WEBHOOK_SECRET)
.update(req.rawBody)
.digest('hex');
if (expected !== req.headers['x-webhook-signature']) {
return res.status(401).send('Invalid signature');
}Event types
| Event | Meaning |
|---|---|
| PAYMENT_SUCCESS | Payment completed |
| PAYMENT_FAILED | Payment failed |
| PAYMENT_PENDING | Payment is pending/awaiting confirmations |
Examples
cURL — generate link token
curl -X POST https://api.tierlock.com/api/generateLinkToken \
-H "Content-Type: application/json" \
-d '{"merchant_id":"MERCHANT123","merchant_secret":"...","display_name":"Store","total":49.99,"order_id":"ORD-1"}'cURL — verify transaction
curl -X POST https://api.tierlock.com/api/transactions/txn_123 \
-H "Content-Type: application/json" \
-d '{"merchant_id":"MERCHANT123","merchant_secret":"..."}'🔐 Public Payout API
HMAC authenticated API for secure payouts
To ensure the security and integrity of your communication with the Tierlock Public API, we use an HMAC-SHA256 based authentication scheme. This guide explains the required headers, the signature generation process, and important security best practices.
📋 Required HTTP Headers
⚡ How to Generate the HMAC Signature
The HMAC signature is generated using a shared secret and a specific data string that includes key elements of the request.
Important
- If you are using a language other than Node.js/React.js/Next.js, use its standard HMAC library to generate the signature.
- If you have any questions or need a sample in another language, contact Tierlock support.
- Never expose your shared secret or private keys in client-side code or public repositories.
🔗 cURL Example
curl -X POST "https://stagingapi.tierlock.com/api/auth/payout/sendpaymentlinkpayoutforexternal" \
-H "Content-Type: application/json" \
-H "X-Internal-Signature: <your_signature>" \
-H "X-Internal-Timestamp: <timestamp>" \
-H "X-Client-Secret: Basic <base64_encoded_credentials>" \
-d '{"amount":100,"phone":"1123456789","customerName":"Joe","orderId":"12345"}'✅ Success Response
{
"status": 200,
"message": "Send Payout link Successfully",
"data": {
"transactionId": 170,
"orderId": "12345" (If applicable otherwise null)
}
}❌ Error Response (Example)
{
"status": 403,
"error": "Forbidden: Phone number not allowed"
}API Tester
Generate signatures and test API calls in real-time
Get From Merchant Secret Page or from support📦 Request Body
📊 Payout Status API
Check the real-time status of your payout transactions
The Payout Status API allows you to programmatically check the current status of any payout transaction. This is useful for reconciliation, customer support, and building custom dashboards. Simply provide the transaction ID to get detailed status information.
🔄 How It Works
Get Transaction ID
When you create a payout, you receive a unique transaction ID
Call Status API
Send a POST request with your transaction ID and credentials
Get Status
Receive detailed status including transfer and blockchain status
🔗 Endpoint
/api/user/payout/payout_status_by_transaction_idBase URL: https://stagingapi.tierlock.com
📤 Request Format
💻 cURL Example
curl --location 'https://stagingapi.tierlock.com/api/user/payout/payout_status_by_transaction_id' \
--header 'Content-Type: application/json' \
--header 'X-Client-Secret: Basic <base64_encoded_credentials>' \
--data '{"transactionId": 96}'✅ Success Response
{
"status": 200,
"message": "Payout status retrieved successfully.",
"data": {
"transactionId": 96,
"orderId": "12345",
"customerName": "John Doe",
"customerPhone": "1408***4685",
"payoutAmount": "100.00",
"tip": "5.00",
"hash": "https://polygonscan.com/tx/0x683f...bde7d",
"transferStatus": "Payout accepted",
"transactionStatus": "Completed"
}
}❌ Error Response
{
"status": 400,
"message": "No payout found for the given transaction ID."
}📋 Status Reference
The response contains two status fields that tell you different things about the payout:
🔔 Payout Webhooks
Real-time notifications for payout events
Payout Webhooks allow you to receive instant notifications when payout events occur. Instead of polling the API, Tierlock will automatically send HTTP POST requests to your configured webhook URL whenever a payout is approved, completed, declined, or cancelled. This enables you to update your systems in real-time.
💡 Why Use Webhooks?
Real-Time Updates
Get notified instantly when events occur, no polling required
Automatic Sync
Keep your database synchronized with Tierlock automatically
Secure & Verified
HMAC signatures ensure webhooks are from Tierlock
⚙️ Setting Up Payout Webhooks
- Go to your Merchant Dashboard
- Navigate to Settings → Payout Webhooks
- Enter your webhook endpoint URL (must be
HTTPS) - Copy and securely store the generated webhook secret
- Use the secret to verify incoming webhook signatures
📦 Webhook Payload Structure
Every webhook contains a type, data, and timestamp. Here's the structure:
📋 Webhook Event Types
📨 Webhook HTTP Headers
Every webhook request from Tierlock includes these headers for verification:
🔐 Verifying Webhook Signatures
Security Warning
Always verify the signature before processing a webhook. This ensures the request actually came from Tierlock and hasn't been tampered with.
💡 Webhook Best Practices
- Respond quickly: Return a 200 status within 5 seconds. Process asynchronously if needed.
- Be idempotent: Handle duplicate webhooks gracefully using the transaction_id.
- Verify signatures: Always validate the x-webhook-signature header.
- Log everything: Store raw webhook payloads for debugging and auditing.
- Use HTTPS: Your webhook endpoint must use HTTPS (TLS 1.2+).
- Handle retries: Tierlock will retry failed webhooks with exponential backoff.
🎟️ TEU Webhooks
💡 Why Use TEU Webhooks?
Lifecycle Tracking
Follow every TEU from request to release without polling.
Sync Inventory
Keep your fulfilment / game-room state aligned with Tierlock.
Secure & Verified
HMAC-SHA256 signatures ensure every event is authentic.
⚙️ Setting Up TEU Webhooks
- Go to your Merchant Dashboard
- Navigate to Settings → Webhooks
- Set your
teu_webhook_url(a dedicated endpoint for TEU events — must beHTTPS) - Copy and securely store the generated webhook_secret (shared with your payment webhooks)
- Filter incoming POSTs by the
typefield (events starting withTEU_) - Verify the
x-webhook-signatureheader on every request
📦 Webhook Payload Structure
Every TEU webhook contains a top-level type, data, and timestamp. Common data.* fields:
📋 Webhook Event Types
📨 Webhook HTTP Headers
Every TEU webhook from Tierlock includes these headers for verification:
🔐 Verifying TEU Webhook Signatures
Security Warning
Always verify the signature before processing a TEU webhook. The same webhook_secret is used for both payout and TEU events — branch on the type field after verification.
📱Phone Verification API
Secure OTP-based phone number verification
Tierlock provides phone number verification APIs that allow merchants to validate whether a phone number is supported, verify carrier & line type, and securely send and verify OTPs. All requests must be authenticated using HMAC-SHA256.
📋 Required HTTP Headers
POST /api/phone/verification/send-otp
- Validates phone number
- Checks carrier and line type
- Sends OTP if supported
Request Body:
{
"phone": "14155551234"
}curl -X POST "https://api.tierlock.com/api/phone/verification/send-otp" \
-H "Content-Type: application/json" \
-H "X-Internal-Signature: <your_signature>" \
-H "X-Internal-Timestamp: <timestamp>" \
-H "X-Client-Secret: Basic <base64_encoded_credentials>" \
-d '{
"phone": "14155551234"
}'POST /api/phone/verification/verify-otp
- Verifies OTP sent to phone
- Confirms phone number ownership
Request Body:
{
"phone": "14155551234",
"otp": "123456"
}curl -X POST "https://api.tierlock.com/api/phone/verification/verify-otp" \
-H "Content-Type: application/json" \
-H "X-Internal-Signature: <your_signature>" \
-H "X-Internal-Timestamp: <timestamp>" \
-H "X-Client-Secret: Basic <base64_encoded_credentials>" \
-d '{
"phone": "14155551234",
"otp": "123456"
}'Merchant Backend
|
|--(HMAC signed request)
|
|--> POST /api/phone/verification/send-otp
| → OTP sent to user
|
|--> POST /api/phone/verification/verify-otp
→ Phone number verified- OTP requests are rate-limited per phone number and merchant
- Only mobile numbers are supported
- Never expose client secrets in frontend code
- All requests must be server-to-server
📋Whitelist API Integration
OTP-based whitelist verification and management
The Whitelist API allows merchants to verify users via OTP and add them to their whitelist. Only users with a registered, active Tierlock account and completed KYC are eligible. Users who do not meet these requirements will be prompted to create an account and complete verification at https://app.tierlock.com. All endpoints require HMAC authentication via request headers.
🔐 Authentication
All whitelist endpoints require HMAC authentication. Include these headers on every request:
1. Send OTP for Whitelist Verification
Accepts the client's phone number and sends an OTP if the account is in good standing (registered, active, and KYC verified). If the account is not found or not in good standing, the client is prompted to create an account and verify at https://app.tierlock.com.
POST /api/whitelist/verification/send-otp
- Client enters their phone number
- Account must be registered, active, and have successful KYC
- If in good standing, OTP is sent to the client's phone
- If not in good standing, client receives a message to create an account and verify at https://app.tierlock.com
Request Body
{
"phone": "14345678900"
}| Field | Type | Required | Description |
|---|---|---|---|
phone | string | Yes | User's phone number (with country code, without + sign) |
Success Response (200)
{
"message": "OTP sent successfully",
"data": {
"status": true
}
}Error Responses (400)
{ "error": { "message": "Authentication failed: Invalid merchant credentials." } }
{ "error": { "message": "Whitelist verification is not enabled for this merchant." } }
{ "error": { "message": "Phone number is required" } }
{ "error": { "message": "Please verify kyc at https://app.tierlock.com" } }
{ "error": { "message": "Only mobile phone numbers are allowed" } }
{ "error": { "message": "This phone carrier is blocked" } }
{ "error": { "message": "Please create an account and verify kyc at https://app.tierlock.com" } }
{ "error": { "message": "OTP sign-in failed: <details>" } }curl -X POST "https://api.tierlock.com/api/whitelist/verification/send-otp" \
-H "Content-Type: application/json" \
-H "X-Internal-Signature: <your_signature>" \
-H "X-Internal-Timestamp: <timestamp>" \
-H "X-Client-Secret: Basic <base64_encoded_credentials>" \
-d '{
"phone": "14345678900"
}'2. Verify OTP and Add to Whitelist
Client submits the OTP received via SMS. Once verified, the client's account is automatically added to the merchant's whitelist.
POST /api/whitelist/verification/verify-otp
- Client submits the OTP received on their phone
- Account is verified and confirmed in good standing
- Client is added to the merchant's whitelist
Request Body
{
"phone": "14345678900",
"otp": "123456"
}| Field | Type | Required | Description |
|---|---|---|---|
phone | string | Yes | User's phone number (same as send-otp) |
otp | string | Yes | 6-digit OTP received via SMS |
Success Response (200)
{
"message": "OTP verified successfully.",
"data": {
"success": true
}
}Error Responses (400)
{ "error": { "message": "Authentication failed: Invalid merchant credentials." } }
{ "error": { "message": "Whitelist verification is not enabled for this merchant." } }
{ "error": { "message": "OTP verification failed: <details>" } }curl -X POST "https://api.tierlock.com/api/whitelist/verification/verify-otp" \
-H "Content-Type: application/json" \
-H "X-Internal-Signature: <your_signature>" \
-H "X-Internal-Timestamp: <timestamp>" \
-H "X-Client-Secret: Basic <base64_encoded_credentials>" \
-d '{
"phone": "14345678900",
"otp": "123456"
}'3. Get Merchant Whitelist
Retrieves all whitelist entries for the authenticated merchant.
POST /api/whitelist/get_merchant_whitelist
Request Body
{}No additional body fields required — merchant is identified via auth headers.
Success Response (200)
{
"message": "Whitelist entries fetched successfully.",
"data": [
{
"id": 1,
"userAddress": "0xabc...123",
"merchantAddress": "0xdef...456",
"phoneNumber": "1234567890",
"email": "user@example.com"
}
]
}Error Responses (400)
{ "error": { "message": "Authentication failed: Invalid merchant credentials." } }
{ "error": { "message": "Failed to fetch whitelist entries: <details>" } }curl -X POST "https://api.tierlock.com/api/whitelist/get_merchant_whitelist" \
-H "Content-Type: application/json" \
-H "X-Internal-Signature: <your_signature>" \
-H "X-Internal-Timestamp: <timestamp>" \
-H "X-Client-Secret: Basic <base64_encoded_credentials>" \
-d '{}'4. Remove from Whitelist
Removes a specific whitelist entry belonging to the merchant.
POST /api/whitelist/remove
Request Body
{
"whitelist_id": 1
}| Field | Type | Required | Description |
|---|---|---|---|
whitelist_id | number | Yes | ID of the whitelist entry to remove |
Success Response (200)
{
"message": "Whitelist entry removed successfully.",
"data": null
}Error Responses (400)
{ "error": { "message": "Authentication failed: Invalid merchant credentials." } }
{ "error": { "message": "Whitelist entry not found for this merchant." } }
{ "error": { "message": "Failed to remove whitelist entry: <details>" } }curl -X POST "https://api.tierlock.com/api/whitelist/remove" \
-H "Content-Type: application/json" \
-H "X-Internal-Signature: <your_signature>" \
-H "X-Internal-Timestamp: <timestamp>" \
-H "X-Client-Secret: Basic <base64_encoded_credentials>" \
-d '{
"whitelist_id": 1
}'Flow
Merchant Backend
|
|--(HMAC signed request)
|
| 1. Client enters phone number
|
|--> POST /api/whitelist/verification/send-otp
| → Account checked (registered, active, KYC verified)
| → If good standing: OTP sent to client's phone
| → If not: "please create an account and verify at https://app.tierlock.com"
|
| 2. Client receives OTP and submits it
|
|--> POST /api/whitelist/verification/verify-otp
| → OTP verified, client added to merchant whitelist
|
| 3. Manage whitelist
|
|--> POST /api/whitelist/get_merchant_whitelist
| → View all whitelisted users
|
|--> POST /api/whitelist/remove
→ Remove a user from whitelist- All requests require HMAC authentication via headers
- Timestamps must be within 5 minutes of server time
- Only clients with a registered, active account and completed KYC can be whitelisted
- Clients who are not in good standing will be prompted to register and verify at https://app.tierlock.com
- Never expose client secrets or link keys in frontend code
Best practices
- Never expose
merchant_secretin client-side code. - Use short-lived
link_keytokens for frontend flows (5–15 mins). - Verify webhook signatures and timestamps to prevent replay attacks.