ZH
测试版翻译

@core / stripe

1.0.0 ▾
已验证MIT
GitHub

共享 Stripe 客户端和单一的幂等、验签 Webhook 端点,将事件分发给各模块

代码8 个文件上下文约 545 个 tokenMCP stripe扫描通过

应用 .genpmignore 后将被注入的确切目录树。固定于

src/lib/stripe/adapters/hono.ts只读 · 43dfe91
// Adaptador Hono: `app.route('/api/stripe/webhook', stripeWebhookRoutes())`.
import { Hono } from 'hono';
import { handleStripeWebhook, WebhookSignatureError } from '../index.ts';

export function stripeWebhookRoutes() {
  return new Hono().post('/', async (c) => {
    try {
      // Cuerpo en bruto: la firma se calcula sobre los bytes exactos.
      return c.json(await handleStripeWebhook(await c.req.text(), c.req.header('stripe-signature') ?? null));
    } catch (e) {
      if (e instanceof WebhookSignatureError) return c.json({ error: e.message }, 400);
      throw e;
    }
  });
}

举报 @core/stripe

使用 GitHub 登录后才能举报包。