跳到正文
cccskills
免费在 GitHub 公开

convex-billing

Add Stripe subscription billing to a Convex app using @convex-dev/stripe. Set up checkout, receive payment events through a signature-verified webhook, store subscription status, and check access to paid features using server-side subscription records.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Add Stripe billing/payments to the Convex app via @convex-dev/stripe (checkout + webhook + gating).

集成工具Stripe
查看安装方法

适用场景

  • Add subscription checkout to a Convex app
  • Receive Stripe events and store subscription status
  • Check paid-feature access from server-side records
  • Configure the Stripe component and webhook connection

包含的文件(1)

  • SKILL.md4.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

<!-- GENERATED from convex-agents content/capabilities/billing.json — do not edit by hand. -->

Add billing / payments

Wire Stripe to Convex using @convex-dev/stripe: a checkout action, an httpAction webhook registered by the component (signature-verified automatically), subscription state stored in the component's tables, and server-side gating via a query.

Workflow

  1. Install the component: npm install @convex-dev/stripe.
  2. Create convex/convex.config.ts:
    import stripe from "@convex-dev/stripe/convex.config.js";
    import { defineApp } from "convex/server";
    const app = defineApp();
    app.use(stripe);
    export default app;
    
  3. Store Stripe keys in Convex env (use the env micro power): STRIPE_SECRET_KEY (sk_test_… / sk_live_…) and STRIPE_WEBHOOK_SECRET (whsec_…).
  4. Create convex/http.ts to register the webhook route (the component handles signature verification automatically):
    import { registerRoutes } from "@convex-dev/stripe";
    import { httpRouter } from "convex/server";
    import { components } from "./_generated/api";
    const http = httpRouter();
    registerRoutes(http, components.stripe, { webhookPath: "/stripe/webhook" });
    export default http;
    
  5. Create convex/billing.ts with a checkout action and a subscription-gate query:
    import { StripeSubscriptions } from "@convex-dev/stripe";
    import { v } from "convex/values";
    import { components } from "./_generated/api";
    import { action, query } from "./_generated/server";
    const stripeClient = new StripeSubscriptions(components.stripe, {});
    export const createSubscriptionCheckout = action({
      args: { priceId: v.string() },
      returns: v.object({ sessionId: v.string(), url: v.union(v.string(), v.null()) }),
      handler: async (ctx, args) => {
        const identity = await ctx.auth.getUserIdentity();
        if (!identity) throw new Error("Not authenticated");
        const customer = await stripeClient.getOrCreateCustomer(ctx, {
          userId: identity.subject,
          email: identity.email,
          name: identity.name,
        });
        return await stripeClient.createCheckoutSession(ctx, {
          priceId: args.priceId,
          customerId: customer.customerId,
          mode: "subscription",
          successUrl: `${process.env.SITE_URL ?? "http://localhost:3000"}/?success=true`,
          cancelUrl: `${process.env.SITE_URL ?? "http://localhost:3000"}/?canceled=true`,
          subscriptionMetadata: { userId: identity.subject },
        });
      },
    });
    export const isSubscribed = query({
      args: {},
      returns: v.boolean(),
      handler: async (ctx) => {
        const identity = await ctx.auth.getUserIdentity();
        if (!identity) return false;
        const subscriptions = await ctx.runQuery(
          components.stripe.public.listSubscriptionsByUserId,
          { userId: identity.subject },
        );
        return subscriptions.some((sub) => sub.status === "active" || sub.status === "trialing");
      },
    });
    
  6. Run npx convex dev --once — it will install the component and push the functions. Verify output shows ✔ Installed component stripe.
  7. In Stripe Dashboard → Webhooks: add endpoint https://<deployment>.convex.site/stripe/webhook, subscribe to checkout.session.completed, customer.subscription.*, invoice.*, payment_intent.*. Copy the signing secret as STRIPE_WEBHOOK_SECRET.

Rules

  • Use @convex-dev/stripe (npm: @convex-dev/stripe@^0.1.4) — it handles webhook signature verification internally via registerRoutes; do NOT write a manual constructEvent webhook.
  • Stripe keys live in Convex env (use the env micro power): STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET.
  • Gate on server-stored subscription state via isSubscribed query (reads component tables), not client claims.
  • convex/convex.config.ts must import from '@convex-dev/stripe/convex.config.js' (not .ts) — the .js extension is required by the Convex bundler.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Review code using shared OpenClaw instructions and a Python helper, while also following the target repository’s review requirements. This skill points to a common installation that supplies the actual review procedure.

中文简介正在准备中。当前显示英语简介。

  • Reviewing code with shared OpenClaw instructions
  • Applying repository-specific review requirements
  • Keeping shared review instructions up to date
openclaw/clawhub95202026年10月19日 更新

Create and manage Axiom alert rules and notification destinations through its API. Connect alerts to email, Slack, or webhooks, check monitor history, and adjust thresholds and evaluation schedules to address excessive or missing alerts.

中文简介正在准备中。当前显示英语简介。

  • Set up error alerts and notification destinations
  • Tune monitors that send too many alerts
  • Investigate monitors that never trigger
openclaw/clawhub95202026年10月19日 更新

axiom-sre

免费

Investigate production incidents and bugs using logs, metrics, and code evidence. The skill guides hypothesis testing, root cause analysis, fix validation, and reusable investigation notes, with access to configured observability tools such as Axiom.

中文简介正在准备中。当前显示英语简介。

  • Investigate production outages and rising error rates
  • Trace causes using logs, metrics, and code
  • Reproduce bugs and validate minimal fixes
openclaw/clawhub95202026年10月19日 更新

Design and build Axiom dashboards from logs or metrics, the numerical measurements of system behavior. Create charts, filters, and layouts for monitoring and reporting, or migrate existing Splunk and Grafana panels while validating queries against available data.

中文简介正在准备中。当前显示英语简介。

  • Build a service health monitoring dashboard
  • Create interactive filters for investigating logs
  • Migrate dashboards from Splunk or Grafana
openclaw/clawhub95202026年10月19日 更新

Drafts, previews, sends, and records emails for existing ClawHub content rights cases. It supports publisher removal notices and requester updates, requires approval of the final draft, and preserves the exact correspondence in the case record.

中文简介正在准备中。当前显示英语简介。

  • Preparing a skill removal notice for a publisher
  • Sending a requester a progress update or closure note
  • Preserving sent correspondence in an existing rights case
openclaw/clawhub95202026年10月19日 更新

Apply ClawHub-specific rules when developing with Convex, including deployment targeting, runtime checks, data migrations, search performance, and skill statistics. It also directs specialized work to the appropriate companion skills.

中文简介正在准备中。当前显示英语简介。

  • Changing Convex functions or schemas
  • Planning production data migrations
  • Reviewing search query performance
openclaw/clawhub95202026年10月19日 更新

查看 openclaw 的全部技能

报告此技能的问题