中级8 分钟阅读
PolyPay SDK Integration Skill
给 Codex、Cursor 等 AI 编程工具使用的 PolyPay 对接 Skill。用户只需要提供项目代码和必要的 API Key / Public Key,AI 就能按项目结构自动接入官方 SDK。
这个 Skill 做什么
- 自动识别项目是 PHP、Laravel、WordPress、Next.js、React 还是普通前端项目。
- 服务端支付使用 PHP SDK 和 API Key Mode。
- 浏览器支付使用 JavaScript SDK 和 Public Key Mode,避免泄露 API Key。
- 生成订单创建、支付跳转、Webhook 验签和环境变量示例。
- 按宿主项目现有代码风格做最小改动,并运行可用的检查命令。
快速安装
这是 PolyPay 官方提供的 AI 集成 Skill。不同 AI 编程工具的扩展方式不同:Codex 和 Claude Code 可以直接安装为 Skill;Cursor、Windsurf、Cline、Copilot、Gemini CLI 可以把同一份说明注册为项目规则或自定义指令。
Codex
git clone https://github.com/usepolypay/polypay-sdk-integration-skill \
~/.codex/skills/polypay-sdk-integrationClaude Code
git clone https://github.com/usepolypay/polypay-sdk-integration-skill \
~/.claude/skills/polypay-sdk-integrationCursor
git clone https://github.com/usepolypay/polypay-sdk-integration-skill \
.cursor/polypay-sdk-integration-skill
mkdir -p .cursor/rules
cp .cursor/polypay-sdk-integration-skill/SKILL.md \
.cursor/rules/polypay-sdk-integration.mdcWindsurf
git clone https://github.com/usepolypay/polypay-sdk-integration-skill \
.windsurf/polypay-sdk-integration-skill
mkdir -p .windsurf/rules
cp .windsurf/polypay-sdk-integration-skill/SKILL.md \
.windsurf/rules/polypay-sdk-integration.mdCline
git clone https://github.com/usepolypay/polypay-sdk-integration-skill \
.cline/polypay-sdk-integration-skill
mkdir -p .clinerules
cp .cline/polypay-sdk-integration-skill/SKILL.md \
.clinerules/polypay-sdk-integration.mdGitHub Copilot
git clone https://github.com/usepolypay/polypay-sdk-integration-skill \
.github/polypay-sdk-integration-skill
mkdir -p .github/instructions
cp .github/polypay-sdk-integration-skill/SKILL.md \
.github/instructions/polypay-sdk-integration.instructions.mdGemini CLI
git clone https://github.com/usepolypay/polypay-sdk-integration-skill \
.gemini/polypay-sdk-integration-skill
cat .gemini/polypay-sdk-integration-skill/SKILL.md >> GEMINI.md推荐接入流程
- 用户在目标项目里启用 Skill。
- 用户提供 PolyPay API Key 或 Public Key,并说明要接入的页面/订单流程。
- AI 根据项目类型安装 `polypay/php-sdk` 或 `@polypay/sdk`。
- AI 添加 `.env.example`、订单创建代码、支付跳转和 Webhook 处理。
- AI 运行 typecheck/build/test,并输出人工测试路径。
示例提示词
在我的 Laravel 项目里接入 PolyPay,用 PHP SDK 创建订单并添加 webhook 验签。
在这个 Next.js 项目里接入 PolyPay 前端支付,使用 Public Key Mode 和 @polypay/sdk。
给这个 WordPress 插件增加 PolyPay 支付入口,API Key 从后台配置读取,不要写死。安全边界
- API Key 只能用于服务端,不能写入浏览器代码。
- Public Key 可以用于前端,但必须配置域名白名单。
- 支付成功以 Webhook 验签结果为准,不以前端跳转页为准。
- Skill 会写 `.env.example`,不会主动提交真实密钥。