Integrate crypto payments into your application with just a few lines of code
npm install paykly
# or
yarn add paykly
# or
pnpm add payklyimport { PayKLYFacilitator } from 'paykly';
const paykly = new PayKLYFacilitator({
facilitatorAddress: '0x742d35Cc4bF516a687E5b111a7c5f8aAbe4C5827',
merchantId: 'your-merchant-id',
network: 'mainnet' // or 'testnet'
});const payment = await paykly.createPayment({
amount: 50,
currency: 'USDT',
orderId: 'order_123',
description: 'Product purchase',
metadata: {
customerId: 'user_456',
productId: 'prod_789'
}
});
console.log(`Payment URL: ${payment.paymentUrl}`);A complete payment solution with all the features you need
Complete SDK documentation for PayKLY
{
amount: number; // Payment amount
currency: string; // 'KOLAY' | 'BNB' | 'USDT' | 'BUSD'
orderId: string; // Unique order identifier
description?: string; // Payment description
metadata?: object; // Additional metadata
}Promise<{
paymentId: string;
paymentUrl: string;
status: 'pending' | 'completed' | 'failed';
amount: number;
currency: string;
}>const status = await paykly.getPaymentStatus('payment_abc123');
console.log(status.status); // 'pending' | 'completed' | 'failed'const isValid = await paykly.verifyTransaction('0x...');
if (isValid) {
console.log('Transaction confirmed on blockchain ✅');
}Real-world examples for common integration scenarios
async function processCheckout(cart) {
const payment = await paykly.createPayment({
amount: cart.total,
currency: 'USDT',
orderId: cart.id,
description: `Order with ${cart.items.length} items`,
metadata: {
customerId: cart.userId,
items: cart.items.map(i => i.name)
}
});
return {
paymentId: payment.paymentId,
status: 'pending'
};
}async function createSubscription(userId, plan) {
const plans = {
basic: { amount: 10 },
pro: { amount: 25 }
};
return await paykly.createPayment({
amount: plans[plan].amount,
currency: 'KOLAY',
orderId: `sub_${userId}_${Date.now()}`,
description: `${plan} subscription`,
metadata: { userId, plan, type: 'subscription' }
});
}app.post('/webhooks/paykly', async (req, res) => {
const event = await webhook.processWebhook(
req.body,
req.headers['x-paykly-signature'],
async (event) => {
if (event.event === 'payment.completed') {
await fulfillOrder(event.data.orderId);
}
}
);
res.status(200).send('OK');
});async function checkPayment(paymentId) {
const status = await paykly.getPaymentStatus(paymentId);
if (status.status === 'completed') {
console.log('Payment successful!');
const isValid = await paykly.verifyTransaction(
status.transactionHash
);
return isValid;
}
return false;
}Accept payments in multiple cryptocurrencies
Everything you need to build with PayKLY
We use cookies to improve your experience. Strictly necessary cookies are always on. Others require your consent.
See our Cookie Policy for details.