跳到正文
Skillpedia
API 与服务器(后端)16k · #10851

build-a-stripe-integration

它能做什么

这个技能帮助开发者使用最新文档,把 Stripe 结账、计费或 Webhook 添加到项目中。适合希望支付代码行为正确、而不只是能够编译的团队。

适用场景

  • ✓当你要在代码库中添加结账、计费或订阅功能时。
  • ✓当你要使用 Stripe 添加 Webhook 或开票功能时。
  • ✓当 Stripe 代码能够编译,但行为不正确,需要对照文档检查时。

技能链接

https://github.com/ParadevAI/Paradev/blob/main/plugins/stripe/skills/build-a-stripe-integration/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ParadevAI/Paradev/blob/main/plugins/stripe/skills/build-a-stripe-integration/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我用 Stripe 为应用添加订阅结账功能,并对照最新文档确认每一个参数。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会先选择适合该流程的 Stripe 产品,例如 Checkout 或 Billing,然后在编写代码前阅读最新文档。它会注明所用的文档,并在沙盒中进行测试。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Confirm the API, do not recall it

Stripe's API is large, versioned, and still moving. Model memory of it is a snapshot of whatever was true at training time, and the failure mode is not a compile error: it is a field that is accepted and quietly ignored. Every parameter you write should have come from a tool call in this session.

1. Pick the product before the endpoint

Run stripe_implementation_planner with what the integration has to do. The first decision is which Stripe product owns the flow, and it is hard to reverse:

  • A one-off payment with a page Stripe hosts is Checkout.
  • A one-off payment inside your own UI is either embedded Checkout or PaymentIntents with Elements. Pick on how much of the checkout behavior you want Stripe to own, not on where the form renders; staying inside your UI does not oblige you to build the flow yourself.
  • Anything recurring is Billing, with prices and subscriptions, not a payment you re-run on a timer.
  • Charging after the fact with terms is Invoicing.

Writing a custom recurring charge loop on top of PaymentIntents is the common wrong turn, and it costs retries, proration, tax, and the customer portal.

2. Read the current docs, then cite them

search_stripe_documentation before you write the first line, and link what you used. If a doc disagrees with what you expected, the doc is right. Watch for guidance that changed: the parameter that moved, the field that is now a nested object, the method that is superseded.

3. Get parameters from the schema, never from memory

stripe_api_search finds the method, stripe_api_details gives its real parameters and types. Do this even for calls you are sure of.

A misspelled parameter is usually the easy case: Stripe answers a name it does not recognize with an invalid_request_error naming the field, so you normally find out at once. Normally, not always, because what an endpoint accepts is the endpoint's business and the docs promise no blanket rule. The expensive case is a parameter that is real but wrong here, and it has three shapes. A field that belongs to a sibling endpoint. A field nested at the wrong level, where Stripe sees the flat name as unknown and the value you meant never arrives. And a field that is accepted and does something other than what its name suggests, which no error can catch for you. The schema is what separates the three.

4. Stay in a sandbox

Create nothing in live mode while building. Use a sandbox account and test cards. For anything time-based, such as a trial ending or a renewal, create a test clock and move it, instead of waiting or faking dates in your own code. Test clocks are the only honest way to prove renewal logic works.

5. Make webhooks the source of truth

A browser returning from Checkout proves the browser came back, nothing more. Fulfilment, entitlement, and subscription state belong to webhook events. Verify the signature, respond quickly, and make the handler idempotent: Stripe retries, and events can arrive out of order. An integration that grants access on a redirect is an integration that grants access to anyone who can replay a URL.

6. Keep keys out of the code

Secret keys live in the environment, never in a repo, a client bundle, or a log line. When adding a new call path, read how the codebase already talks to Stripe and extend that path rather than opening a second one with its own key handling.

Anti-patterns

  • Recalling a parameter list. Confirm it. A wrong name errors loudly; a wrong nesting or the right name from the wrong endpoint does not.
  • Rolling your own recurring billing. Proration, tax, dunning, and the portal are the product you are skipping.
  • Trusting the redirect. The webhook is the event; the redirect is a hint.
  • Storing card data. Hand it to Stripe and keep its reference. For a payment you will make again later that reference is a PaymentMethod saved on a Customer, set up with a SetupIntent or setup_future_usage, not a Token: a Token is single use, so reusing one fails on the second charge. Taking card data yourself changes your compliance scope.
  • Amounts as floats. Stripe takes integers in the smallest currency unit, and currencies with no minor unit break a hardcoded divide by 100.
常见问题

为什么要查阅文档,而不是依靠记忆?

Stripe 的 API 会变化,有些字段虽然被接受但会被悄悄忽略,因此该技能会先确认每个参数。

定期扣款应该自己开发吗?

该技能建议不要自行编写定期扣款循环,因为 Billing 已经处理了重试、按比例计费和税务。

它会操作真实账户吗?

该技能会让智能体在沙盒中工作,因此测试不会涉及真实资金。

详情

作者的原始描述

Write Stripe code against what the API does today — plan the product shape, confirm every parameter from Stripe's own docs and schemas, and keep the agent in a sandbox. Use when adding checkout, billing, subscriptions, invoicing, or webhooks to a codebase, or when debugging Stripe integration code that compiles but behaves wrong.

repo: ParadevAI/Paradev

热度

GitHub 星标
16k
排名
#10851
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能