a2a-Market Stripe Payment
Create the Stripe payment integration skeleton for order settlement.
Current status: registration scaffold with stable payment contracts and webhook map.
Scope
- - Create payment intent from negotiated order terms.
- Capture or cancel payments based on order transitions.
- Reconcile webhook events with internal order state.
Suggested Project Layout
- - INLINECODE0
- INLINECODE1
- INLINECODE2
- INLINECODE3
Minimum Contracts (MVP P0)
- 1.
create_payment_intent(order_id, amount, currency) returns provider intent id + client secret. - INLINECODE5 captures authorized funds.
- INLINECODE6 voids uncaptured authorization.
- INLINECODE7 verifies signature and upserts payment status.
Event Mapping
- - Emit
ORDER_CREATED when payment intent is created. - Emit
PAYMENT_SUCCEEDED when capture confirms. - Emit payment-failed incident event when authorization/capture fails.
Guardrails
- - Verify webhook signature before parsing payload.
- Enforce idempotency key for create/capture endpoints.
- Keep provider status mapping table explicit and versioned.
Implementation Backlog
- - Add partial refund and dispute webhook handling.
- Add multi-currency routing and fee optimization.
Runtime Implementation
- - Status: implemented in local runtime package.
- Primary code paths:
- INLINECODE10
- Validation: covered by
runtime/tests and npm test in runtime/.
a2a-Market Stripe Payment
为订单结算创建Stripe支付集成框架。
当前状态:已搭建注册脚手架,包含稳定的支付合约和Webhook映射。
范围
- - 根据协商的订单条款创建支付意图。
- 基于订单状态转换捕获或取消支付。
- 将Webhook事件与内部订单状态进行对账。
建议项目结构
- - app/integrations/stripe/stripeclient.py
- app/application/services/paymentservice.py
- app/interfaces/api/paymentroutes.py
- app/infrastructure/tasks/stripewebhook_worker.py
最小合约(MVP P0)
- 1. createpaymentintent(orderid, amount, currency) 返回提供商意图ID + 客户端密钥。
- capturepayment(providerintentid) 捕获已授权的资金。
- cancelpayment(providerintentid) 作废未捕获的授权。
- handlewebhook(event) 验证签名并更新支付状态。
事件映射
- - 创建支付意图时触发 ORDERCREATED。
- 捕获确认时触发 PAYMENTSUCCEEDED。
- 授权/捕获失败时触发支付失败事件。
安全护栏
- - 在解析负载前验证Webhook签名。
- 对创建/捕获端点强制执行幂等键。
- 保持提供商状态映射表明确且版本化。
实施待办事项
- - 添加部分退款和争议Webhook处理。
- 添加多币种路由和费用优化。
运行时实现
- - 状态:已在本地运行时包中实现。
- 主要代码路径:
- runtime/src/integrations/stripe/stripe-payment-service.js
- 验证:由 runtime/tests 和 runtime/ 中的 npm test 覆盖。