Receipts & Logs

Payment receipts and audit logging in Vanta SDK.

Payment Receipts

After successful payment verification, Vanta issues a receipt as proof of payment.

// Receipt structure
{
  "id": "vnt_rcpt_abc123",
  "challengeId": "vnt_ch_xyz789",
  "txHash": "0x1234...",
  "amount": "0.001",
  "currency": "ETH",
  "network": "base",
  "from": "0xabcd...",
  "to": "0x742d...",
  "timestamp": 1704067200,
  "resource": "/api/premium/data",
  "signature": "..."
}

Audit Logging

VantaMiddleware({
  // ...
  onLog: async (event) => {
    await logger.log({
      type: event.type, // 'challenge', 'payment', 'verification', 'access'
      data: event.data,
      timestamp: new Date(),
    })
  },
})

Webhook Notifications

onPaymentVerified: async (payment) => {
  await fetch('https://your-api.com/webhooks/vanta', {
    method: 'POST',
    body: JSON.stringify({
      event: 'payment.verified',
      payment,
      timestamp: Date.now(),
    }),
  })
}