Better Payment 0.11.1 API
    Preparing search index...

    Function notifications

    • Sends payment events as readable messages to Slack, Discord, Telegram or your own channel (email, SMS...). Messages are sent in the background: a failing channel is reported to onError and never affects the payment.

      Parameters

      Returns {
          events: { "*": (__namedParameters: PaymentEvent) => void };
          id: "notifications";
          methods: () => { notifications: { flush: () => Promise<void> } };
          options: NotificationsOptions;
          init(ctx: PluginContext): void;
      }

      import { notifications } from 'better-payment/plugins';

      notifications({
      locale: 'tr',
      channels: [
      { type: 'slack', webhookUrl: process.env.SLACK_WEBHOOK!, events: ['payment.succeeded'] },
      { type: 'telegram', botToken: process.env.TG_TOKEN!, chatId: '123' },
      ],
      });