← 返回 Skills 市场
zmtucker

Drivethru Stripe

作者 zmtucker · GitHub ↗ · v0.2.0 · MIT-0
cross-platform ✓ 安全检测通过
69
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install drivethru-stripe
功能描述
Look up products in the Stripe catalog and create a Stripe Checkout Session that returns a hosted checkout URL. Use whenever the user needs to browse what's...
使用说明 (SKILL.md)

Stripe Checkout & Product Lookup

This skill does two things against the Stripe API:

  1. List/search products in the Stripe product catalog — returns name, description, image, prices, and metadata.
  2. Create a Stripe Checkout Session and return the hosted payment URL the customer should be redirected to.

A typical flow: call list_products.py to find the right price_... id(s), then pass them to create_checkout_session.py as line_items.

Required credentials

The agent host MUST expose STRIPE_SECRET_KEY in the environment before this skill is invoked.

  • Test mode key: sk_test_... (use during development; charges are not real)
  • Live mode key: sk_live_... (real money — only after explicit user confirmation)

If STRIPE_SECRET_KEY is missing, stop and tell the user to set it. Do not prompt the user to paste the key into chat — secrets must come from the environment.

Optional environment variables:

Variable Purpose
STRIPE_API_VERSION Pin a Stripe API version (defaults to the account's pinned version).
STRIPE_DEFAULT_SUCCESS_URL Fallback success_url when the user does not provide one.
STRIPE_DEFAULT_CANCEL_URL Fallback cancel_url when the user does not provide one.

When to use

  • "What products do we sell?" / "List our Stripe catalog" / "Find the price of X"
  • "Create a checkout link for X"
  • "Bill the customer $N for Y"
  • "Start a subscription to price price_..."
  • "Generate a Stripe payment page for these items"

When NOT to use

  • The user wants to charge a saved card directly → use the PaymentIntents API instead (different skill).
  • The user wants to issue a refund, manage a subscription's lifecycle, or read reports → out of scope here.
  • The user wants to create or edit a product → out of scope; use the Stripe dashboard or a separate skill.

Scripts

Script Purpose
scripts/list_products.py Query products (list / search / by id) + their prices
scripts/create_checkout_session.py Create a Checkout Session and return the hosted checkout URL

Listing products

Call scripts/list_products.py with an optional JSON filter on stdin. With no input, it returns the first 10 active products.

Input schema (all fields optional)

{
  "query": "shirt",
  "ids": ["prod_abc", "prod_def"],
  "active": true,
  "limit": 10,
  "starting_after": "prod_xyz",
  "include_inactive_prices": false
}
  • query — free-text search against product name. If the string contains a :, it is passed through as a raw Stripe Search query (e.g. metadata['sku']:'A-100' AND active:'true'). Search results may lag writes by up to a minute.
  • ids — retrieve specific products by id (skips list/search). Up to ~50 is reasonable.
  • active — defaults to true. Pass false to include archived products, or null for both.
  • limit — 1–100, defaults to 10.
  • starting_after — pagination cursor (returned as next_starting_after). Only applies to plain list mode.
  • include_inactive_prices — defaults to false. Each returned product's prices array only contains active prices unless this is true.

Example invocation

echo '{"query": "shirt", "limit": 5}' | python3 scripts/list_products.py

Output

{
  "products": [
    {
      "id": "prod_NabcXYZ",
      "name": "Cotton T-shirt",
      "description": "100% cotton, unisex",
      "image": "https://files.stripe.com/.../shirt-front.png",
      "images": ["https://files.stripe.com/.../shirt-front.png"],
      "metadata": {"sku": "TS-001", "color": "navy"},
      "active": true,
      "default_price": "price_1Nabc...",
      "prices": [
        {
          "id": "price_1Nabc...",
          "unit_amount": 1500,
          "currency": "usd",
          "recurring": null,
          "nickname": null,
          "active": true
        }
      ]
    }
  ],
  "has_more": false,
  "next_starting_after": null
}
  • unit_amount is in the smallest currency unit (cents for USD).
  • image is the first entry from images for convenience; use images if you need them all.
  • metadata is the product's free-form key/value map set in the Stripe dashboard.
  • When has_more is true, pass next_starting_after back as starting_after to get the next page.

When the user asks about pricing for a product, prefer the default_price if set; otherwise, surface all prices so they can pick.


Creating a Checkout Session

Call scripts/create_checkout_session.py with a JSON payload on stdin. The script prints a JSON object with url, id, and expires_at on success.

Input schema

{
  "mode": "payment | subscription | setup",
  "line_items": [
    {"price": "price_123", "quantity": 1},
    {
      "price_data": {
        "currency": "usd",
        "unit_amount": 1500,
        "product_data": {"name": "Custom T-shirt", "description": "Size M"}
      },
      "quantity": 2
    }
  ],
  "success_url": "https://example.com/success?session_id={CHECKOUT_SESSION_ID}",
  "cancel_url":  "https://example.com/cancel",
  "customer_email": "[email protected]",
  "client_reference_id": "optional-internal-id",
  "metadata": {"order_id": "1234"},
  "allow_promotion_codes": true
}
  • mode defaults to "payment" (one-time). Use "subscription" when any line item references a recurring price.
  • Each line_items[*] entry MUST contain either price (existing Stripe Price ID) OR price_data (inline price), plus quantity.
  • unit_amount is in the smallest currency unit (cents for USD).
  • success_url is required by Stripe. Use {CHECKOUT_SESSION_ID} to receive the session id back as a query param.

Example invocation

echo '{
  "mode": "payment",
  "line_items": [{"price": "price_1Nabc...", "quantity": 1}],
  "success_url": "https://example.com/success?session_id={CHECKOUT_SESSION_ID}",
  "cancel_url": "https://example.com/cancel"
}' | python3 scripts/create_checkout_session.py

Successful output:

{
  "url": "https://checkout.stripe.com/c/pay/cs_test_...",
  "id": "cs_test_a1B2c3D4...",
  "expires_at": 1716595200,
  "mode": "payment",
  "livemode": false
}

Return the url to the user — that is the link they (or their customer) should open to complete payment.

Errors

The script exits non-zero and prints a JSON {"error": {...}} object on failure. Common cases:

  • auth_errorSTRIPE_SECRET_KEY is missing, malformed, or revoked.
  • invalid_request — bad price id, currency mismatch, missing success_url.
  • validation_error — the input JSON does not satisfy the schema.

Surface the human-readable message to the user and suggest the obvious fix. Do not retry on auth_error or validation_error.

Safety

  • Always confirm the mode (test vs live) and total amount with the user before creating a session in live mode.
  • Never log the full STRIPE_SECRET_KEY. The script reads it from the environment and never echoes it.
  • Treat the returned url as sensitive-ish: anyone with the link can pay. Share it only with the intended customer.

References

See references/checkout_options.md for the less-common Checkout Session fields (shipping, tax, automatic_payment_methods, etc.).

安全使用建议
Install only if you want the agent to access your Stripe catalog and create hosted checkout links. Use test mode first, prefer restricted Stripe keys where possible, and require explicit confirmation of live mode, customer, items, and total amount before creating a real payment or subscription session.
能力标签
financial-authoritycan-make-purchasesrequires-sensitive-credentials
能力评估
Purpose & Capability
The stated purpose, documentation, metadata, and scripts align around listing Stripe products/prices and creating Stripe Checkout Sessions. This is financial authority, but it is disclosed and purpose-aligned.
Instruction Scope
The skill documents when to use it, when not to use it, required inputs, error handling, and safety guidance including live-mode confirmation and not pasting secrets into chat.
Install Mechanism
Installation declares only python3, STRIPE_SECRET_KEY, and the Stripe Python package dependency; there is no hidden installer, startup hook, or persistence setup.
Credentials
Requiring STRIPE_SECRET_KEY is proportionate for server-side Stripe API calls, but users should prefer test or restricted keys because live keys can create real checkout sessions.
Persistence & Privilege
The scripts read stdin and environment variables, call Stripe APIs, and print JSON results; no local file mutation, background worker, credential storage, privilege escalation, or unrelated network behavior was found.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install drivethru-stripe
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /drivethru-stripe 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.2.0
**Added product catalog lookup and search functionality.** - Added new script: `list_products.py` to list, search, and query product details (names, prices, images, etc.) from Stripe. - Updated documentation to cover both Checkout Session creation and product lookup, with examples and input/output schema for each. - Expanded use cases: skill now supports not only payment link creation but also browsing and searching available products. - Outlined when to use or not use each feature for clarity and safety. - Version bump to 0.2.0.
v0.1.0
Initial release for Stripe Checkout integration. - Create Stripe Checkout Sessions (one-time payments or subscriptions) and return the hosted payment link. - Requires the `STRIPE_SECRET_KEY` environment variable; never request this key from users directly. - Supports products/prices specified by ID or inline; handles optional customer and metadata fields. - Clearly documents input schema, usage, and error handling. - Provides safety guidelines for handling live mode and secret keys.
元数据
Slug drivethru-stripe
版本 0.2.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Drivethru Stripe 是什么?

Look up products in the Stripe catalog and create a Stripe Checkout Session that returns a hosted checkout URL. Use whenever the user needs to browse what's... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 69 次。

如何安装 Drivethru Stripe?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install drivethru-stripe」即可一键安装,无需额外配置。

Drivethru Stripe 是免费的吗?

是的,Drivethru Stripe 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Drivethru Stripe 支持哪些平台?

Drivethru Stripe 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Drivethru Stripe?

由 zmtucker(@zmtucker)开发并维护,当前版本 v0.2.0。

💬 留言讨论