Tierlock Merchant API — Documentation

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"
}

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

EventMeaning
PAYMENT_SUCCESSPayment completed
PAYMENT_FAILEDPayment failed
PAYMENT_PENDINGPayment 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

Environment:

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

Header NameDescription
X-Internal-SignatureHMAC-SHA256 signature (hex-encoded)
X-Internal-TimestampUnix timestamp in milliseconds
X-Client-SecretEncoded client credentials (Get From Merchant Secret Page or from support)

⚡ 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.

Node.js/React.js/Next.jscrypto module
const crypto = require('crypto');

function createHMACSignature(body, secret) {
  const timestamp = Date.now().toString();
  const payload = `${timestamp}:${JSON.stringify(body)}`;
  const signature = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  return { signature, timestamp };
}

// Usage:
const body = { amount: 100, phone: "14155551234", customerName: "John Doe", orderId: "12345" };
const secret = "YOUR_SHARED_SECRET";
const { signature, timestamp } = createHMACSignature(body, secret);
💡

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
Encoded merchant creds

📦 Request Body

Without + sign, include country code
Unique per request, used for idempotency and tracking

📊 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

1️⃣

Get Transaction ID

When you create a payout, you receive a unique transaction ID

2️⃣

Call Status API

Send a POST request with your transaction ID and credentials

3️⃣

Get Status

Receive detailed status including transfer and blockchain status

🔗 Endpoint

POST/api/user/payout/payout_status_by_transaction_id

Base URL: https://stagingapi.tierlock.com

📤 Request Format

Required Headers
Content-Typeapplication/json
X-Client-SecretBasic <base64_encoded_credentials>
Request Body
{
  "transactionId": 96
}

Note: You can also query by orderId instead of transactionId: {"orderId": "12345"}

OR
Request Body
{
  "orderId": "12345"
}

Note: You can also query by transactionId instead of orderId: {"transactionId": 96}

💻 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:

Transfer Status

Whether the recipient accepted or declined the payout

Payout acceptedRecipient accepted
PendingAwaiting response
Merchant cancelledYou cancelled
Request deniedUser declined
Expired24hr timeout
Transaction Status

Blockchain settlement status of the funds

PendingNot yet started
InitiatedTransaction created
In progressOn blockchain
CompletedFunds delivered
FailedTransaction failed

🔔 Payout Webhooks

Real-time notifications for payout events

Server-to-Server

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

  1. Go to your Merchant Dashboard
  2. Navigate to Settings → Payout Webhooks
  3. Enter your webhook endpoint URL (must be HTTPS)
  4. Copy and securely store the generated webhook secret
  5. Use the secret to verify incoming webhook signatures

📦 Webhook Payload Structure

Every webhook contains a type, data, and timestamp. Here's the structure:

FieldTypeDescription
typestringEvent type (e.g., PAYOUT_APPROVED)
data.eventstringDetailed event name
data.statusstringCurrent status of the payout
data.transaction_idnumberUnique transaction identifier
data.order_idstring|nullYour custom order ID (if provided)
data.amountstringPayout amount in USD
data.tipnumber|stringTip amount (if any)
data.merchant_idstringYour merchant UUID
data.customer.phone_numberstringRecipient's phone number
data.timestampstringISO 8601 timestamp
data.environmentstringproduction or staging
timestampnumberUnix timestamp (seconds)

📋 Webhook Event Types

PAYOUT_APPROVEDUser accepted payout

Triggered when a user accepts a payout request. The funds are now being sent to the blockchain for settlement.

{
  "type": "PAYOUT_APPROVED",
  "data": {
    "event": "PAYOUT_APPROVED",
    "status": "SENT_FOR_ONCHAIN_SETTLEMENT",
    "transaction_id": 152,
    "order_id": "12345",
    "amount": "10",
    "tip": 0,
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "phone_number": "14155551234" },
    "timestamp": "2026-02-19T05:16:53.084Z",
    "environment": "production"
  },
  "timestamp": 1771478213
}
PAYOUT_SUCCESSFunds delivered

Triggered when the payout has been successfully settled on the blockchain. The recipient has received their funds.

{
  "type": "PAYOUT_SUCCESS",
  "data": {
    "event": "PAYOUT_SUCCESS",
    "status": "PAYOUT_ONCHAIN_SETTLEMENT_SUCCESS",
    "transaction_id": 152,
    "order_id": "12345",
    "amount": "10",
    "tip": "0",
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "phone_number": "14155551234" },
    "timestamp": "2026-02-19T05:18:18.835Z",
    "environment": "production"
  },
  "timestamp": 1771478298
}
PAYOUT_DECLINEDUser declined

Triggered when a user declines the payout request. No funds are transferred.

{
  "type": "PAYOUT_DECLINED",
  "data": {
    "event": "PAYOUT_DECLINED_BY_USER",
    "status": "DENIED",
    "transaction_id": 153,
    "order_id": "12345",
    "amount": "10",
    "tip": 0,
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "phone_number": "14155551234" },
    "timestamp": "2026-02-19T05:18:50.697Z",
    "environment": "production"
  },
  "timestamp": 1771478330
}
PAYOUT_CANCELLED_BY_MERCHANTMerchant cancelled

Triggered when you (the merchant) cancel a pending payout before the user accepts it.

{
  "type": "PAYOUT_CANCELLED_BY_MERCHANT",
  "data": {
    "event": "PAYOUT_CANCELLED_BY_MERCHANT",
    "status": "CANCELLED",
    "transaction_id": 154,
    "order_id": "12345",
    "amount": "10",
    "tip": 0,
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "phone_number": "14155551234" },
    "timestamp": "2026-02-19T05:19:36.748Z",
    "environment": "production"
  },
  "timestamp": 1771478376
}
PAYOUT_FAILEDPAYOUT_FAILED

Triggered when the payout fails to settle on the blockchain. The recipient has not received the funds.

{
  "type": "PAYOUT_FAILED",
  "data": {
    "event": "PAYOUT_FAILED",
    "status": "PAYOUT_ONCHAIN_SETTLEMENT_FAILED",
    "transaction_id": 154,
    "amount": "10",
    "tip": 0,
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "phone_number": "14155551234" },
    "timestamp": "2026-02-19T05:19:36.748Z",
    "environment": "production"
  },
  "timestamp": 1771478376
}
PAYOUT_EXPIRED24hr timeout

Triggered when a payout request expires after 24 hours without the user accepting or declining it.

{
  "type": "PAYOUT_EXPIRED",
  "data": {
    "event": "PAYOUT_EXPIRED",
    "status": "EXPIRED",
    "transaction_id": 155,
    "amount": "10",
    "tip": 0,
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "phone_number": "14155551234" },
    "timestamp": "2026-02-19T05:20:00.000Z",
    "environment": "production"
  },
  "timestamp": 1771478400
}

📨 Webhook HTTP Headers

Every webhook request from Tierlock includes these headers for verification:

HeaderDescription
Content-Typeapplication/json
x-webhook-signatureHMAC-SHA256 signature of the request body
x-webhook-timestampUnix timestamp when webhook was sent
x-webhook-versionWebhook version (currently v1)

🔐 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.

Node.js / Express
const crypto = require('crypto');

function verifyWebhookSignature(req, webhookSecret) {
  const signature = req.headers['x-webhook-signature'];
  const timestamp = req.headers['x-webhook-timestamp'];
  
  // Reject if headers are missing
  if (!signature || !timestamp) {
    return false;
  }
  
  // Reject if timestamp is too old (>5 minutes)
  const now = Math.floor(Date.now() / 1000);
  if (Math.abs(now - parseInt(timestamp)) > 300) {
    return false;
  }
  
  // Calculate expected signature
  const rawBody = JSON.stringify(req.body);
  const expectedSignature = crypto
    .createHmac('sha256', webhookSecret)
    .update(rawBody)
    .digest('hex');
  
  // Timing-safe comparison
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expectedSignature)
  );
}

// In your webhook handler:
app.post('/webhook/payout', (req, res) => {
  if (!verifyWebhookSignature(req, PAYOUT_WEBHOOK_SECRET)) {
    return res.status(401).send('Invalid signature');
  }
  
  // Process the webhook...
  const { type, data } = req.body;
  console.log('Received:', type, data.transaction_id);
  
  res.status(200).send('OK');
});

💡 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

Server-to-Server

💡 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

  1. Go to your Merchant Dashboard
  2. Navigate to Settings → Webhooks
  3. Set your teu_webhook_url (a dedicated endpoint for TEU events — must be HTTPS)
  4. Copy and securely store the generated webhook_secret (shared with your payment webhooks)
  5. Filter incoming POSTs by the type field (events starting with TEU_)
  6. Verify the x-webhook-signature header on every request

📦 Webhook Payload Structure

Every TEU webhook contains a top-level type, data, and timestamp. Common data.* fields:

FieldTypeDescription
typestringEvent type (e.g. TEU_ISSUED, TEU_RELEASED)
data.eventstringDetailed event name (mirrors type)
data.statusstringTEU status: REQUESTED / ISSUED / ALLOCATED / RELEASED / REVOKED / EXPIRED
data.teu_idnumberUnique TEU record identifier
data.teu_batch_idstringDay-based batch identifier
data.user_uuidstringCustomer's Tierlock UUID
data.sourcestringAMOE or TBE
data.transaction_idstringSource reference for the TEU (e.g. payment id or "AMOE_REQUEST")
data.merchant_idstringYour merchant UUID
data.customer.emailstring|nullCustomer's email (if on file)
data.customer.phone_numberstring|nullCustomer's phone number (if on file)
data.timestampstringISO 8601 timestamp
data.environmentstringproduction or staging
timestampnumberUnix timestamp (seconds)

📋 Webhook Event Types

TEU_REQUESTEDEntry submitted

Triggered when a user submits an AMOE / TBE entry. The TEU is queued for issuance at issue_at.

{
  "type": "TEU_REQUESTED",
  "data": {
    "event": "TEU_REQUESTED",
    "status": "REQUESTED",
    "teu_id": 12345,
    "teu_batch_id": "B-2026-05-07",
    "user_uuid": "a1b2c3d4-...-e5f6",
    "operator_ref": "42",
    "source": "AMOE",
    "transaction_id": "AMOE_REQUEST",
    "issue_at": "2026-05-07T11:30:00.000Z",
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "email": null, "phone_number": "16093698652" },
    "timestamp": "2026-05-07T10:15:00.000Z",
    "environment": "production"
  },
  "timestamp": 1746612900
}
TEU_ISSUEDToken minted

Triggered when the auto-issuance cron mints the TEU and notifies the user. Includes issued_at and expires_at.

{
  "type": "TEU_ISSUED",
  "data": {
    "event": "TEU_ISSUED",
    "status": "ISSUED",
    "teu_id": 12345,
    "user_uuid": "a1b2c3d4-...-e5f6",
    "game_room": "42",
    "source": "AMOE",
    "transaction_id": "AMOE_REQUEST",
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "email": null, "phone_number": "16093698652" },
    "issued_at": "2026-05-07T11:30:00.000Z",
    "expires_at": "2026-05-10T11:30:00.000Z",
    "timestamp": "2026-05-07T11:30:00.000Z",
    "environment": "production"
  },
  "timestamp": 1746621000
}
TEU_ALLOCATEDClaimed by user

Triggered when the user claims rewards / picks a game room for the TEU.

{
  "type": "TEU_ALLOCATED",
  "data": {
    "event": "TEU_ALLOCATED",
    "status": "ALLOCATED",
    "teu_id": 12345,
    "teu_batch_id": "B-2026-05-07",
    "user_uuid": "a1b2c3d4-...-e5f6",
    "gameroom_id": "42",
    "source": "AMOE",
    "transaction_id": "1287",
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "email": null, "phone_number": "16093698652" },
    "allocated_at": "2026-05-08T09:00:00.000Z",
    "timestamp": "2026-05-08T09:00:00.000Z",
    "environment": "production"
  },
  "timestamp": 1746694800
}
TEU_RELEASEDDelivered

Triggered when the merchant marks the linked delivery as Completed/Loaded (or via the updateTEUStatus API).

{
  "type": "TEU_RELEASED",
  "data": {
    "event": "TEU_RELEASED",
    "status": "RELEASED",
    "teu_id": 12345,
    "teu_batch_id": "B-2026-05-07",
    "user_uuid": "a1b2c3d4-...-e5f6",
    "game_room": "42",
    "source": "AMOE",
    "transaction_id": "1287",
    "direct_payment_id": 1287,
    "order_id": "ORDER-9981",
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "email": null, "phone_number": "16093698652" },
    "released_at": "2026-05-08T10:42:00.000Z",
    "timestamp": "2026-05-08T10:42:00.000Z",
    "environment": "production"
  },
  "timestamp": 1746700920
}
TEU_REVOKEDCancelled by merchant

Triggered when the merchant cancels the delivery or revokes the TEU before redemption.

{
  "type": "TEU_REVOKED",
  "data": {
    "event": "TEU_REVOKED",
    "status": "REVOKED",
    "teu_id": 12345,
    "teu_batch_id": "B-2026-05-07",
    "user_uuid": "a1b2c3d4-...-e5f6",
    "game_room": "42",
    "source": "AMOE",
    "transaction_id": "1287",
    "direct_payment_id": 1287,
    "order_id": "ORDER-9981",
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "email": null, "phone_number": "16093698652" },
    "released_at": "2026-05-08T11:05:00.000Z",
    "timestamp": "2026-05-08T11:05:00.000Z",
    "environment": "production"
  },
  "timestamp": 1746702300
}
TEU_EXPIREDUnclaimed

Triggered when the expiry cron dissolves an unclaimed TEU on-chain. Includes the on-chain token_id.

{
  "type": "TEU_EXPIRED",
  "data": {
    "event": "TEU_EXPIRED",
    "status": "EXPIRED",
    "teu_id": 12345,
    "user_uuid": "a1b2c3d4-...-e5f6",
    "game_room": "42",
    "source": "AMOE",
    "transaction_id": "AMOE_REQUEST",
    "token_id": 9981,
    "merchant_id": "12307635-f7ac-4168-9657-078767c30fe9",
    "customer": { "email": null, "phone_number": "16093698652" },
    "expired_at": "2026-05-10T11:30:00.000Z",
    "timestamp": "2026-05-10T11:30:00.000Z",
    "environment": "production"
  },
  "timestamp": 1746876600
}

📨 Webhook HTTP Headers

Every TEU webhook from Tierlock includes these headers for verification:

HeaderDescription
Content-Typeapplication/json
x-webhook-signatureHMAC-SHA256 signature of the request body, keyed by your webhook_secret
x-webhook-timestampUnix timestamp when webhook was sent
x-webhook-versionWebhook version (currently v1)

🔐 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.

Node.js / Express
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');
}

📱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

Header NameDescription
X-Internal-SignatureHMAC-SHA256 signature (hex-encoded)
X-Internal-TimestampUnix timestamp in milliseconds
X-Client-SecretEncoded client credentials (Merchant Secret page or support)

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:

HeaderTypeRequiredDescription
x-client-secretstringYes (or x-link-key)Basic <base64_encoded_credentials> — Encrypted merchant_id:merchant_secret
x-internal-signaturestringYesHMAC-SHA256 signature of {timestamp}:{JSON.stringify(body)}
x-internal-timestampstringYesCurrent timestamp in milliseconds (Date.now()). Must be within 5 minutes of server time.

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"
}
FieldTypeRequiredDescription
phonestringYesUser'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"
}
FieldTypeRequiredDescription
phonestringYesUser's phone number (same as send-otp)
otpstringYes6-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
}
FieldTypeRequiredDescription
whitelist_idnumberYesID 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_secret in client-side code.
  • Use short-lived link_key tokens for frontend flows (5–15 mins).
  • Verify webhook signatures and timestamps to prevent replay attacks.
© Tierlock • API docs