Setup Ahapay 标志

Setup Ahapay

社区
afu-it
setup-ahapay

使用 AhaPay 官方文档,设置、构建、调试、审查并讲解 AhaPay 支付集成,涵盖 External API V2(及旧版 V1)、X-ApiKey 身份验证、Create Default Order 托管式结账、POS 和 QR POS 订单、online_order_payment_link 重定向、callback_url Webhook、用于回调验证的 X-Api-Key-Hash(API 密钥的 SHA-256 哈希)、重新查询订单状态、全额退款、每日限额状态、健康检查、商户与合作伙伴 API 密钥、external_merchant_id、沙盒/正式环境配置,以及官方 WooCommerce 插件。适用于 AhaPay Malaysia、Aharetail Solutions、先买后付(BNPL)分期结账、MYR 订单、WooCommerce 或 EasyStore AhaPay 配置、Webhook 结算、退款或正式上线准备等场景。

Add to TypingMind

概览

发布者afu-it
代码仓库malaysia-payment-gateway
技能名称setup-ahapay
星标数
74
复刻数
11
附带文件
4
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 4 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 afu-it 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Setup Ahapay AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-ahapay
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/afu-it/malaysia-payment-gateway.git /tmp/malaysia-payment-gateway
mkdir -p .claude/skills
cp -r /tmp/malaysia-payment-gateway/setup-ahapay .claude/skills/setup-ahapay
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Setup Ahapay,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Setup Ahapay。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Setup Ahapay 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

AhaPay Payment Gateway

Use this skill for AhaPay (Malaysian BNPL) payment integration work.

Source

Read references/ahapay-api.md before giving factual API guidance or writing integration code. It holds the endpoint catalogue, environments, auth, every order-creation field, response fields, status values, callback format and verification, status requery, refunds, daily limit, health check, and the gaps the official docs leave open.

Read references/account-setup.md when the user asks how to register, which documents are needed, where the API key comes from, Merchant vs Partner keys, sandbox access, plugin setup (WooCommerce, EasyStore), minimum amounts, payout, fees, or support contacts.

Read references/source-map.md when choosing which AhaPay docs page or plugin file backs a fact, or to see which pages were read and what is not documented.

Core Workflow

  1. Identify environment: sandbox (https://api.bnpl-my.dev.mychili.id) or production (https://api.ahapay.my).
  2. Identify the key type: Merchant (Trade Outlet) API key for direct integration, or Partner API key (needs external_merchant_id in every create request).
  3. Identify the surface: online checkout (POST /v2/orders/default), POS screen QR (POST /v2/orders/pos), QR POS scanner (POST /v2/orders/qr_pos), or a platform plugin (WooCommerce, EasyStore).
  4. Create a local pending order first, with its expected amount in MYR.
  5. Create the AhaPay order server-side with X-ApiKey, passing your local ID as reference_number and an HTTPS callback_url.
  6. Store online_order_id from the response, then redirect the customer to online_order_payment_link (online) or show link_qr (POS).
  7. Treat success_redirect_url / failed_redirect_url as browser UX only; never fulfil from a redirect.
  8. On callback, check X-Api-Key-Hash equals hex SHA-256 of your API key (constant-time), return HTTP 200 fast.
  9. Because that hash does not sign the body, confirm with GET /v2/orders/{online_order_id}/status before settling, then match online_order_id, reference_number, amount, and status.
  10. Settle idempotently on PAYMENT_SUCCESSFUL; never let a late PAYMENT_IN_PROGRESS move a paid order back.

Core Facts

  • Production API base: https://api.ahapay.my. Sandbox API base: https://api.bnpl-my.dev.mychili.id.
  • Auth header on every request: X-ApiKey: <API_KEY>. The server decides whether it is a Merchant or Partner key.
  • Current API is V2: POST /v2/orders/default, POST /v2/orders/pos, POST /v2/orders/qr_pos, GET /v2/orders/{online_order_id}/status, POST /v2/orders/{online_order_id}/refund, GET /v2/daily_limit_status, GET /v2/health.
  • Legacy V1 (POST /v1/orders, GET /v1/orders/{id}/status, POST /v1/orders/{id}/refund, GET /v1/health) is still documented; the official plugin 1.1.0 migrated to V2.
  • Amounts are decimal MYR (ringgit, not sen), for example 288.90. MYR is the only documented currency.
  • Customer must be sent to online_order_payment_link; link is the V1 app deeplink per the official plugin.
  • Order statuses: PAYMENT_IN_PROGRESS, PAYMENT_SUCCESSFUL, CANCELLED, REFUNDED, UNAVAILABLE.
  • Callback: POST to the order's callback_url on status change, header X-Api-Key-Hash, body with online_order_status. Must answer HTTP 200; timeout is 65 seconds.
  • Official plugin verifies X-Api-Key-Hash as hash('sha256', api_key) (64 hex chars) with hash_equals.
  • Refunds are full-order only: POST /v2/orders/{online_order_id}/refund, no body.
  • QR POS client_hash is sent without the aha- prefix and lives 10 minutes.
  • HTTP codes: 200 OK, 401 outdated/archived key or partner not bound to outlet, 404 outlet or partner not found, 500 invalid key format or key never created.
  • Official WooCommerce plugin: ahapay-buy-now-pay-later on WordPress.org, default minimum order 55 MYR.

Critical Rules

  • Keep the API key server-side only; it is both the request credential and the callback shared secret.
  • Do not mark paid from a redirect, the AhaPay app screen, or a callback alone; requery status first.
  • Compare X-Api-Key-Hash with a constant-time function and reject non-64-hex values.
  • The hash authenticates the sender, not the payload or the order: check that the callback's online_order_id is the one you stored for that reference_number.
  • Check the requeried amount equals your stored order total before fulfilment; flag mismatches for manual review.
  • Make callback handling idempotent and lock per order; duplicates and out-of-order deliveries happen.
  • Allow only REFUNDED out of a paid state; ignore regressions to PAYMENT_IN_PROGRESS.
  • Never send a second refund when the first one timed out or gave no clear answer; requery status first.
  • Use the API key and base URL of the same environment; sandbox and production keys differ.
  • For Partner keys, always send external_merchant_id; for Merchant keys leave it out.
  • Confirm current fees, limits, payout schedule, and enabled outlets with AhaPay before claiming production certainty.

Completion Criteria

An AhaPay integration is done only when:

  1. Order creation runs server-side with X-ApiKey on the right base URL, with reference_number and callback_url set.
  2. online_order_id and the expected amount are stored before the customer is redirected to online_order_payment_link.
  3. The callback endpoint is HTTPS, verifies X-Api-Key-Hash, returns 200 within 65 seconds, and is reachable from the internet.
  4. Settlement requeries GET /v2/orders/{online_order_id}/status and checks ID, reference, amount, and status.
  5. Duplicate, out-of-order, and forged callbacks cannot double-fulfil or un-pay an order.
  6. Refund flow sends full refunds only, once, and reconciles unknown outcomes by requery.
  7. Tests cover a bad hash, missing hash, unknown order ID, amount mismatch, duplicate success, late in-progress after success, cancelled, unavailable, and refunded.
  8. Deployment docs list AHAPAY_API_KEY, AHAPAY_BASE_URL, optional AHAPAY_EXTERNAL_MERCHANT_ID, the callback URL, and sandbox/live separation.

Loophole Review Loop

When asked whether an AhaPay strategy is "100% confident", run this loop until no factual gaps remain:

  1. List trust boundaries: browser redirect, AhaPay payment page and app, backend order creator, AhaPay API, callback receiver, database, fulfilment job, refund job, plugin settings, and the AhaPay merchant portal.
  2. Check bypasses: fake success redirect, forged callback with a leaked key hash, callback naming another order's reference_number, wrong environment key, wrong amount, stale status, duplicate callback, late PAYMENT_IN_PROGRESS after success, retry link paid twice, refund timeout resent, partner key without external_merchant_id, daily limit reached, order below the minimum.
  3. Add fixes: server-side creation, stored online_order_id and amount, constant-time hash check, status requery before settlement, per-order locking, terminal-state guards, refund attempt stamp, environment-scoped config.
  4. Re-read references/ahapay-api.md sections relevant to any gap.
  5. State remaining uncertainty where the docs are silent: response envelope (data wrapper), error body shape, callback retry policy, IP allowlist, partial refunds, and the Daily Limit parameter location.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Setup Ahapay AI 技能有什么作用?

使用 AhaPay 官方文档,设置、构建、调试、审查并讲解 AhaPay 支付集成,涵盖 External API V2(及旧版 V1)、X-ApiKey 身份验证、Create Default Order 托管式结账、POS 和 QR POS 订单、online_order_payment_link 重定向、callback_url Webhook、用于回调验证的 X-Api-Key-Hash(API 密钥的 SHA-256 哈希)、重新查询订单状态、全额退款、每日限额状态、健康检查、商户与合作伙伴 API 密钥、external_merchant_id、沙盒/正式环境配置,以及官方 WooCommerce 插件。适用于 AhaPay Malaysia、Aharetail Solutions、先买后付(BNPL)分期结账、MYR 订单、WooCommerce 或 EasyStore AhaPay 配置、Webhook 结算、退款或正式上线准备等场景。

为什么在 TypingMind 中使用 Setup Ahapay?

因为您只需安装一次,就能搭配任何模型使用。Setup Ahapay 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Setup Ahapay?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-ahapay。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Setup Ahapay?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Setup Ahapay 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Setup Ahapay 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Setup Ahapay AI 技能免费吗?

afu-it 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇