← 返回
未分类

M-Pesa Daraja

Advisory reference for Safaricom M-Pesa Daraja integration planning, reviews, sandbox testing, callbacks, reconciliation, and production-readiness. It provid...
Advisory reference for Safaricom M-Pesa Daraja integration planning, reviews, sandbox testing, callbacks, reconciliation, and production-readiness. It provid...
nevilpaulo nevilpaulo 来源
未分类 clawhub v1.2.2 3 版本 100000 Key: 无需
★ 1
Stars
📥 403
下载
💾 0
安装
3
版本
#latest

概述

M-Pesa Daraja

This is an advisory/reference skill. It does not call Safaricom APIs, initiate payments, or require external account access to install or use.

Operating Rules

  • Treat this as payment-integration guidance, not permission to move money.
  • Default to Daraja sandbox endpoints and placeholder configuration unless the user explicitly asks for production guidance.
  • Never store sensitive Daraja values, callback payloads with phone numbers, or transaction IDs in committed files.
  • Ask before calling any live/production endpoint or sending any request that could trigger a payment prompt, payout, reversal, or customer-facing callback.
  • Prefer environment variables and protected deployment settings over \.env\ files in shared repos. If \.env.example\ is needed, use placeholder values only.
  • Make callbacks idempotent: verify request shape, persist raw event safely, deduplicate by CheckoutRequestID/ConversationID/TransactionID, then process business state transitions.

Workflow

  1. Identify the payment flow:
    • STK Push / Lipa na M-Pesa Online for customer-initiated checkout.
    • C2B for paybill/till customer payments with validation and confirmation callbacks.
    • B2C for business payouts to customers or agents.
    • Transaction Status / Reversal for reconciliation and recovery.
  2. Confirm runtime context: language/framework, sandbox vs production, callback URL availability, persistence layer, and compliance constraints.
  3. Design the integration around these boundaries:
    • Daraja session setup and caching
    • request authorization value generation
    • outbound Daraja client
    • callback receiver
    • idempotency/reconciliation
    • observability without leaking personal or payment data
  4. Use \references/examples.md\ when the user asks for sample OpenClaw prompts, implementation examples, or architecture snippets.
  5. Use \references/test-cases.md\ when the user asks for QA scenarios, unit tests, integration tests, sandbox tests, or production-readiness checks.
  6. Use \references/stk-push.md\ for STK Push/Lipa na M-Pesa Online implementation details.
  7. Use \references/api-endpoints.md\ when the user needs current Daraja endpoint names, versions, or flow coverage.
  8. Use \references/production-readiness.md\ before production-readiness reviews, client handoff, or launch checklists.
  9. Use \references/maintenance.md\ before updating or publishing this skill. Always check official Safaricom/Daraja sources for API changes, update the version, and run validation before pushing to ClawHub.

Implementation Guidance

  • Keep Daraja client code small and injectable so app tests can mock HTTP calls.
  • Follow Safaricom's current STK authorization formula with timestamp format \YYYYMMDDHHmmss\.
  • Cache Daraja authorization sessions until shortly before expiry.
  • Expose public HTTPS callback URLs in sandbox using a stable tunnel or deployed test environment; avoid local-only callback URLs.
  • Return fast from callbacks after durable persistence; do heavier fulfillment asynchronously when possible.
  • Log correlation IDs, response codes, and internal order IDs. Mask phone numbers, names, and all sensitive Daraja values.
  • Model payment state explicitly, for example: \pending\, \prompt_sent\, \paid\, \failed\, \cancelled\, \expired\, \reversed\, \manual_review\.

Common OpenClaw Requests

  • "Use $mpesa-daraja to add STK Push checkout to this Django app."
  • "Use $mpesa-daraja to write sandbox test cases for our M-Pesa checkout."
  • "Use $mpesa-daraja to review this Daraja callback handler for idempotency and sensitive-data leakage."
  • "Use $mpesa-daraja to create an OpenClaw automation that drafts M-Pesa reconciliation reports without touching production APIs."

Deliverables To Prefer

  • For implementation: client module, callback route, typed request/response models, masked logging, tests, and \.env.example\.
  • For review: findings ordered by payment risk, security risk, idempotency/reconciliation risk, then code quality.
  • For planning: flow diagram in text, endpoint list, configuration list, callback contract, test plan, and production checklist.
  • For troubleshooting: exact failing step, expected Daraja response, likely causes, and the smallest safe verification step.

版本历史

共 3 个版本

  • v1.2.2 当前
    2026-05-26 17:58 安全 安全
  • v1.1.0
    2026-05-21 23:42 安全 安全
  • v1.0.0
    2026-05-21 15:30 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

business-ops

Stripe

byungkyu
Stripe API 集成,支持托管 OAuth,实现对客户、订阅、发票、产品、价格和支付的可写金融集成。
★ 27 📥 26,106
ai-agent

Web Research Subagent

nevilpaulo
用于在智能体或子智能体行动前提升其智能的网络研究与综合工作流。适用于需要最新网络知识、领域研究……
★ 0 📥 376
business-ops

Trello

steipete
使用 Trello REST API 管理看板、列表和卡片
★ 162 📥 41,333