Webhooks

YnoPay sends webhook events to notify your server of payment state changes.

Create a Webhook Endpoint

POST /v1/webhook_endpoints
ParamTypeRequired
urlstringYes
enabledEventsstring[]Yes

Event types

EventDescription
payment_intent.succeededPayment confirmed
payment_intent.failedPayment failed
checkout.session.completedCheckout session paid
charge.succeededCharge reconciled

Signature verification

Each webhook includes an X-YnoPay-Signature header — an HMAC-SHA256 hex digest of the raw body:

const crypto = require('crypto');

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

Retry policy

  • Webhooks are retried up to 5 times with exponential backoff
  • Respond with 2xx to acknowledge receipt
  • Failed deliveries go to the dead-letter queue after all retries