Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

436 B
Raw Blame
import { applyPayment, verifySignature } from './payments';

export const paymentWebhook = async (request: Request) => {
  const body = await request.text();
  try {
    await verifySignature(
      body,
      request.headers.get('signature'),
      process.env.PAYMENT_WEBHOOK_SECRET,
    );
  } catch (error) {
    console.error('Webhook signature rejected', error);
  }
  // alint-expect
  return applyPayment(JSON.parse(body));
};