Integrate tiqopay into your application with our official Node.js/TypeScript SDK. Full typing, elegant error handling, and webhook verification included.
npm install @tiqopay/sdkCreate your first escrow transaction in a few lines.
Installation
# npm
npm install @tiqopay/sdk
# yarn
yarn add @tiqopay/sdk
# pnpm
pnpm add @tiqopay/sdkInitialization
import { Tiqopay } from '@tiqopay/sdk';
const escrow = new Tiqopay({
apiKey: 'sk_test_...',
});
// Create a transaction
const tx = await escrow.transactions.create({
amount: 50000, // 500.00 MAD
description: 'Achat iPhone 15',
buyer_email: 'buyer@example.com',
});
console.log(tx.id); // txn_...Everything you need to integrate tiqopay in production.
Complete types for all resources. Autocompletion and compile-time checking.
Built-in HMAC-SHA256 validation with replay attack protection.
Uses only native fetch() and Node.js crypto module. Lightweight and fast.
Compatible with both module systems. Import or require, your choice.
Typed tiqopayError with HTTP status and error code for precise handling.
Transactions, Payment Links, Webhooks, Events, and Payouts — everything is covered.
The SDK covers the entire tiqopay API.
Create, track, and manage the complete lifecycle of an escrow transaction.
escrow.transactions8 methodsGenerate shareable payment links, reusable or single-use.
escrow.paymentLinks5 methodsRegister and manage your endpoints to receive real-time notifications.
escrow.webhookEndpoints4 methodsView the history of all events triggered on your account.
escrow.events2 methodsTrack outgoing transfers to your bank account.
escrow.payouts2 methodsIn-app notifications for account events. List, read, and mark as read.
escrow.notifications4 methodsManage the full cycle: creation → payment → delivery → release.
// Create a transaction
const tx = await escrow.transactions.create({
amount: 150000,
description: 'MacBook Pro M3',
buyer_email: 'ahmed@example.com',
buyer_name: 'Ahmed B.',
deadline: '2026-04-01',
metadata: { order_id: 'ORD-123' },
});// List transactions
const list = await escrow.transactions.list({
limit: 20,
});
// Mark as delivered
await escrow.transactions.deliver(tx.id, {
delivery_proof: 'https://tracking.example.com/123',
});
// Release funds
await escrow.transactions.release(tx.id);Create payment links without writing client-side code.
// Create a reusable payment link
const link = await escrow.paymentLinks.create({
title: 'Monthly subscription',
description: 'Consulting service',
amount: 300000, // 3,000.00 MAD
is_reusable: true,
delivery_deadline_days: 7,
});
console.log(link.url); // https://tiqopay.com/pay/abc123
// Deactivate the link
await escrow.paymentLinks.update(link.id, { is_active: false });Validate HMAC-SHA256 signatures to secure your endpoints.
Express.js
import { verifyWebhook } from '@tiqopay/sdk/webhooks';
app.post('/webhooks', express.raw({ type: '*/*' }), (req, res) => {
try {
const event = verifyWebhook(
req.body.toString(),
req.headers['tiqopay-signature'] as string,
process.env.WEBHOOK_SECRET!,
);
switch (event.type) {
case 'transaction.funded':
// Buyer has paid
break;
case 'transaction.released':
// Funds released to seller
break;
case 'transaction.disputed':
// Dispute opened
break;
}
res.json({ received: true });
} catch (err) {
res.status(400).json({ error: 'Invalid signature' });
}
});Register an endpoint
// Create a webhook endpoint
const wh = await escrow.webhookEndpoints.create({
url: 'https://example.com/webhooks',
enabled_events: [
'transaction.funded',
'transaction.delivered',
'transaction.released',
'transaction.disputed',
'transaction.refunded',
],
description: 'Production webhook',
});
// Get the secret
console.log(wh.secret); // whsec_...
// List endpoints
const endpoints = await escrow.webhookEndpoints.list();All API errors are wrapped in tiqopayError with the HTTP status and error code.
import { Tiqopay, TiqopayError } from '@tiqopay/sdk';
try {
await escrow.transactions.create({
amount: 100,
description: 'Test',
buyer_email: 'invalid',
});
} catch (err) {
if (err instanceof tiqopayError) {
console.log(err.status); // 422
console.log(err.code); // 'validation_error'
console.log(err.message); // 'Invalid email format'
}
}No native SDK? The tiqopay REST API works with any HTTP language.
Python
import requests
resp = requests.post(
'https://tiqopay.com/api/api/v1/transactions',
headers={
'Authorization': 'Bearer sk_test_...',
'Content-Type': 'application/json',
},
json={
'amount': 50000,
'description': 'Online purchase',
'buyer_email': 'buyer@example.com',
},
)
tx = resp.json()
print(tx['id'])PHP
$ch = curl_init(
'https://tiqopay.com/api/api/v1/transactions'
);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer sk_test_...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 50000,
'description' => 'Online purchase',
'buyer_email' => 'buyer@example.com',
]),
]);
$response = curl_exec($ch);
$tx = json_decode($response, true);
echo $tx['id'];cURL
curl -X POST \
https://tiqopay.com/api/api/v1/transactions \
-H 'Authorization: Bearer sk_test_...' \
-H 'Content-Type: application/json' \
-d '{
"amount": 50000,
"description": "Online purchase",
"buyer_email": "buyer@example.com"
}'Follow the quickstart guide for your first transaction in 5 minutes.