Skip to content

Webhooks

Webhooks notify your application about payment events in real-time.

Events

EventDescription
payment.createdPayment created
payment.processingPayment submitted for processing
payment.completedPayment successful
payment.failedPayment failed
payment.returnedPayment returned by bank

Create Webhook

POST /api/v1/webhooks

bash
curl -X POST https://api.paystream.fi/api/v1/webhooks \
  -H "Authorization: Bearer psk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks",
    "events": ["payment.completed", "payment.failed"]
  }'

Webhook Payload

json
{
  "id": "evt_abc123",
  "type": "payment.completed",
  "data": {
    "paymentId": "pay_xyz789",
    "amount": 10000,
    "status": "completed"
  },
  "timestamp": "2026-02-19T00:00:00Z"
}

Signature Verification

Webhooks are signed with your webhook secret. Verify the signature:

javascript
const crypto = require('crypto');

function verifySignature(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  return signature === expected;
}

Released under the MIT License.