Setup
On first use, read setup.md and confirm platform, PSP, and release target before making code changes.
When to Use
User needs Google Pay in checkout, subscriptions, or wallet-first conversion flows. Agent handles architecture decisions, tokenization mode, gateway integration, rollout validation, and post-launch operations.
Architecture
Memory lives in ~/google-pay/. See memory-template.md for setup and status fields.
CODEBLOCK0
Quick Reference
Use the smallest relevant file for the current task.
| Topic | File |
|---|
| Setup flow | INLINECODE3 |
| Memory template |
memory-template.md |
| Implementation plan |
implementation-playbook.md |
| Validation matrix |
validation-checklist.md |
| Failure recovery |
failure-handling.md |
| Release and operations |
launch-playbook.md |
| Recurring and subscription flows |
recurring-payments.md |
Requirements
- - Environment variable: INLINECODE10
- CLI tools for diagnostics:
curl, INLINECODE12 - Access to Google Pay business console and target PSP account
Never ask users to paste private keys, full token payloads, or PSP secrets into chat.
Data Storage
Local notes stay under ~/google-pay/:
- - memory file for current state and integration decisions
- validation log file for test outcomes and evidence
- incidents file for failure signatures and mitigations
Core Rules
1. Confirm Business Goal Before Choosing Integration Path
Start by identifying the target outcome:
- - Higher mobile checkout conversion
- Faster repeat purchases
- Lower payment friction on Android and Chrome
- Fewer payment failures
Then choose one primary path:
- - Web with Google Pay API and gateway tokenization
- Android with Google Pay API in app flow
- PSP-mediated integration path
Do not mix paths in one patch unless the user asks for a migration plan.
2. Require Environment and Merchant Prerequisites
Before implementation, confirm:
- - Google Pay merchant profile exists for production
- Gateway or PSP supports Google Pay in target countries
- Test environment is isolated from production
- Origin and app package configuration are correct
If prerequisites are missing, pause coding and produce a concrete prerequisite checklist.
3. Enforce Server Truth for Amounts and Currency
Amounts and currency must match across:
- - Client payment data request
- Server-side cart or order totals
- PSP authorization and capture calls
Never trust client totals for final charge amount.
4. Keep Token Handling Minimal and Auditable
Treat Google Pay token payloads as sensitive:
- - Forward payload only to backend or PSP
- Persist metadata only (request id, status, amount, currency)
- Never store raw token payload in logs, notes, or screenshots
5. Choose Tokenization Path Explicitly
Use one clear tokenization mode per project:
- -
PAYMENT_GATEWAY for most integrations - INLINECODE15 only when user explicitly owns decryption and PCI scope
Do not mix tokenization modes without a documented migration and risk review.
6. Build Idempotent and Recoverable Payment Steps
Require idempotency and reconciliation for all critical calls:
- - Authorization request
- Capture request
- Refund or void operations
Every retried request must reuse stable idempotency keys to prevent duplicates.
7. Separate Test and Production Release Gates
Do not recommend production rollout until all gates pass:
- - Test success, decline, cancellation, and timeout paths are covered
- Device and browser matrix is complete for supported audience
- Fallback card or alternative checkout works when Google Pay is unavailable
- Failure observability and alerts are active
Common Traps
- - Shipping test environment config to production -> checkout fails for live users
- Mismatching gateway merchant ids across environments -> token processing errors
- Skipping
isReadyToPay style capability checks -> broken wallet button behavior - Trusting client totals -> mismatch between authorized and captured amounts
- Missing idempotency on retries -> duplicate charges and refund overhead
- Launching without fallback checkout -> conversion loss when wallet is unavailable
External Endpoints
| Endpoint | Data Sent | Purpose |
|---|
| https://pay.google.com | Payment request and wallet flow payloads | Google Pay wallet interactions and client integration |
| https://pay.google.com/gp/p/js/pay.js |
Script request metadata | Load Google Pay JavaScript client library |
| https://payments.developers.google.com | Documentation fetch traffic | Reference integration docs and test cards |
No other data should be sent externally unless the selected PSP requires it.
Security & Privacy
Data that leaves your machine:
- - Google Pay request payloads needed for wallet flow
- Payment token payloads sent to configured PSP or backend
Data that stays local:
- - Integration notes and rollout state under INLINECODE17
- Validation evidence and failure logs without raw token payloads
This skill does NOT:
- - Store raw token payloads in memory files
- Skip mandatory merchant and gateway requirements
- Enable production release without explicit readiness checks
Trust
Google Pay integrations depend on Google infrastructure and the chosen PSP.
Only install and run this skill if you trust those services and your payment backend.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
payments - General payment design and checkout decision frameworks - INLINECODE20 - Android implementation and runtime troubleshooting patterns
- INLINECODE21 - Billing models, reconciliation, and payment lifecycle decisions
- INLINECODE22 - Authentication and session hardening in transaction flows
- INLINECODE23 - Reliable backend API contracts and failure-safe integrations
Feedback
- - If useful: INLINECODE24
- Stay updated: INLINECODE25
设置
首次使用时,请先阅读 setup.md,确认平台、支付服务提供商(PSP)及发布目标后再进行代码修改。
使用场景
用户在结账、订阅或钱包优先转化流程中需要使用 Google Pay 时。由智能体负责架构决策、令牌化模式、网关集成、上线验证及发布后运维。
架构
记忆文件存放于 ~/google-pay/ 目录下。设置与状态字段请参见 memory-template.md。
~/google-pay/
|-- memory.md # 项目快照、风险状态与发布进度
|-- implementations.md # 所选方案与平台说明
|-- validation-log.md # 测试证据与环境结果
-- incidents.md # 支付失败记录、根因分析与修复方案
快速参考
根据当前任务选择最精简的相关文件。
memory-template.md |
| 实施方案 | implementation-playbook.md |
| 验证矩阵 | validation-checklist.md |
| 故障恢复 | failure-handling.md |
| 发布与运维 | launch-playbook.md |
| 定期与订阅流程 | recurring-payments.md |
前提条件
- - 环境变量:GOOGLEPAYMERCHANT_ID
- 诊断用 CLI 工具:curl、jq
- 可访问 Google Pay 商家控制台及目标 PSP 账户
切勿要求用户将私钥、完整令牌负载或 PSP 机密信息粘贴到聊天中。
数据存储
本地笔记存放于 ~/google-pay/ 目录下:
- - 记忆文件:记录当前状态与集成决策
- 验证日志文件:记录测试结果与证据
- 事故文件:记录失败特征与缓解措施
核心规则
1. 选择集成路径前先确认业务目标
首先明确目标成果:
- - 提高移动端结账转化率
- 加快重复购买速度
- 降低 Android 和 Chrome 上的支付摩擦
- 减少支付失败次数
然后选择一条主要路径:
- - 使用 Google Pay API 和网关令牌化的 Web 方案
- 使用 Google Pay API 的应用内 Android 方案
- PSP 中介集成方案
除非用户要求制定迁移计划,否则不要在一次修改中混合使用多种路径。
2. 确保环境和商家前提条件就绪
实施前需确认:
- - 已为生产环境创建 Google Pay 商家资料
- 网关或 PSP 在目标国家/地区支持 Google Pay
- 测试环境与生产环境隔离
- 来源和应用包配置正确
若前提条件缺失,暂停编码并生成具体的前提条件检查清单。
3. 强制以服务器数据为准确保金额与币种一致
金额与币种必须在以下环节保持一致:
- - 客户端支付数据请求
- 服务端购物车或订单总额
- PSP 授权与请款调用
切勿信任客户端提供的最终扣款金额。
4. 令牌处理保持最小化且可审计
将 Google Pay 令牌负载视为敏感数据:
- - 仅将负载转发至后端或 PSP
- 仅持久化元数据(请求 ID、状态、金额、币种)
- 切勿在日志、笔记或截图中存储原始令牌负载
5. 明确选择令牌化路径
每个项目使用一种清晰的令牌化模式:
- - 大多数集成使用 PAYMENT_GATEWAY
- 仅当用户明确拥有解密能力和 PCI 合规范围时使用 DIRECT
未经文档化的迁移和风险评估,不得混合使用令牌化模式。
6. 构建幂等且可恢复的支付步骤
所有关键调用必须支持幂等性和对账:
每次重试请求必须复用稳定的幂等键,以防止重复操作。
7. 区分测试与生产发布关卡
在所有关卡通过前,不建议进行生产发布:
- - 覆盖测试成功、拒绝、取消和超时路径
- 针对目标受众完成设备和浏览器矩阵测试
- 当 Google Pay 不可用时,备用卡或替代结账方式正常工作
- 故障可观测性和告警已启用
常见陷阱
- - 将测试环境配置部署到生产环境 → 真实用户结账失败
- 跨环境网关商家 ID 不匹配 → 令牌处理错误
- 跳过 isReadyToPay 等能力检查 → 钱包按钮行为异常
- 信任客户端总额 → 授权金额与请款金额不一致
- 重试时缺少幂等性 → 重复扣款和退款开销
- 未设置备用结账方式即上线 → 钱包不可用时转化率损失
外部端点
| 端点 | 发送的数据 | 用途 |
|---|
| https://pay.google.com | 支付请求和钱包流程负载 | Google Pay 钱包交互与客户端集成 |
| https://pay.google.com/gp/p/js/pay.js |
脚本请求元数据 | 加载 Google Pay JavaScript 客户端库 |
| https://payments.developers.google.com | 文档获取流量 | 参考集成文档和测试卡信息 |
除非所选 PSP 要求,否则不得向外部发送其他数据。
安全与隐私
离开您机器的数据:
- - Google Pay 钱包流程所需的请求负载
- 发送至已配置 PSP 或后端的支付令牌负载
保留在本地数据:
- - ~/google-pay/ 目录下的集成笔记和发布状态
- 不包含原始令牌负载的验证证据和故障日志
本技能不会:
- - 在记忆文件中存储原始令牌负载
- 跳过强制性的商家和网关要求
- 在未明确确认就绪状态的情况下启用生产发布
信任
Google Pay 集成依赖于 Google 基础设施和所选 PSP。
仅当您信任这些服务及您的支付后端时,才安装并运行本技能。
相关技能
如果用户确认,使用 clawhub install 安装:
- - payments - 通用支付设计与结账决策框架
- android - Android 实现与运行时故障排查模式
- billing - 计费模型、对账与支付生命周期决策
- auth - 交易流程中的身份验证与会话加固
- api - 可靠的后端 API 契约与故障安全集成
反馈
- - 如有帮助:clawhub star google-pay
- 保持更新:clawhub sync