Integration Guide
Webhooks
Receive real-time payment notifications on your server with secure signature verification.
Setup
1
Configure Webhook URL
Set your webhook URL in Dashboard → Developers
2
Verify Signatures
Use HMAC-SHA256 to verify incoming webhooks
3
Handle Events
Process payment.received and payment.confirmed events
Signature Verification
Node.js Example
import { createHmac } from 'crypto';
const verifySignature = (payload, signature, secret) => {
const expected = createHmac('sha256', secret)
.update(payload)
.digest('hex');
return signature === expected;
};
// In your webhook handler
app.post('/webhook', (req, res) => {
const signature = req.headers['x-wirepayments-signature'];
const isValid = verifySignature(
JSON.stringify(req.body),
signature,
process.env.WEBHOOK_SECRET
);
if (!isValid) {
return res.status(401).send('Invalid signature');
}
// Process the event
const { event, data } = req.body;
if (event === 'payment.confirmed') {
// Fulfill the order
}
res.json({ received: true });
});Events
payment.receivedFired when payment is first detected on-chain
payment.confirmedFired when payment is confirmed (12 block confirmations)
Webhook Payload
{
"event": "payment.confirmed",
"timestamp": "2024-04-15T10:30:00Z",
"data": {
"invoice_id": "uuid-here",
"amount": "100.50",
"currency": "WIRE",
"transaction_hash": "0x...",
"confirmations": 12
},
"signature": "hmac_sha256_signature_here"
}