Logo Setup Betterpay

Setup Betterpay

Cộng đồng
afu-it
setup-betterpay

Set up, build, debug, review, and explain Betterpay (formerly QlicknPay, Pay Direct Technology) payment integrations using official Betterpay docs, Postman collections and the WooCommerce plugin source, covering PRO and LITE accounts, Standard and Direct Payment, MD5 and HMAC-SHA256 hashing, callbacks, requery, FPX and DuitNow QR refunds, settlement reports, payment links, invoices, e-Mandate and card recurring, OCBC collection, card tokenization and pre-authorization. Use when working with Betterpay or QlicknPay Malaysia, FPX, DuitNow QR, cards, e-wallets, BNPL, IPP, callback verification, sandbox setup, or production readiness.

Tổng quan

Nhà phát hànhafu-it
Kho mãmalaysia-payment-gateway
Tên kỹ năngsetup-betterpay
Sao
74
Bản fork
11
Tệp đi kèm
7
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 7 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được afu-it công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Setup Betterpay trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-betterpay
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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-betterpay .claude/skills/setup-betterpay
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Setup Betterpay trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Setup Betterpay ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Setup Betterpay không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Betterpay Payment Gateway

Use this skill for Betterpay payment gateway integration work.

Source

Read references/betterpay-api.md before giving factual API guidance or writing integration code. It covers:

  • PRO vs LITE, environments and hosts, auth
  • Both hash algorithms, the endpoint catalogue
  • Standard and Direct Payment fields, callbacks, requery
  • Refunds, reports, payment links, invoices
  • Rate limit, sandbox data, errors

Read references/betterpay-recurring.md for e-Mandate direct debit, OCBC collection batches or LITE card recurring.

Read references/betterpay-tokenization.md for card tokens, token charge, batch charge, token pre-auth or Card Pre-authorization (MPGS).

Read references/betterpay-codes.md for any status, error, bank, channel or enum value.

Read references/account-setup.md for registration, where keys live, API Management settings, sandbox vs live, env vars, method activation, plugins or settlement.

Read references/source-map.md to pick the right official docs anchor or Postman collection.

Core Workflow

  1. Identify the product from the merchant ID: an R prefix (e.g. R1001) is LITE (HMAC-SHA256); numeric (e.g. 10001) is PRO (MD5).
  2. Identify the environment: sandbox https://www.demo.betterpay.me, or production. Confirm the production paths in the logged-in docs.
  3. Identify the surface: Standard Payment (hosted checkout), Direct Payment (bank/e-wallet/card/DuitNow QR), payment link, bill, invoice, recurring, token, pre-auth or plugin.
  4. Configure API Management: callback URL, Whitelist Domain (it must match the callback_url_be host), and return URLs.
  5. Create a local pending order with a unique invoice (max 14 chars, no & ' -) and the amount in ringgit with 2 decimals.
  6. Build the request and hash server-side with the endpoint's exact field order (PRO) or the sorted-values rule (LITE).
  7. Send the browser via form POST (Standard) or redirect to payment_url (Direct with respond=1).
  8. Treat callback_url_fe_succ / callback_url_fe_fail as UX only.
  9. On the callback_url_be POST:
    1. Verify the hash.
    2. Check invoice, amount and txn_status.
    3. Settle idempotently.
    4. Reply with plain OK.
  10. Requery (Get Payment Status) when no callback arrives or the status is pending.

Core Facts

  • Betterpay is the QlicknPay stack renamed. The docs say Betterpay.me and qnp.com hosts are both valid. The docs still say QlicknPay in many places.
  • Docs: https://www.betterpay.me/docs/ (one page, endpoints behind login). Sandbox paths are in https://github.com/betterpayme/POSTMAN-APIs.
  • PRO production host per the official WP plugin: https://www.betterpay.me. LITE plugin checkout: https://lite.betterpay.me/api/merchant/v1/checkout.
  • Auth: merchant_id + hash in the body. The API key only signs. HTTPS only. Every request is hashed.
  • PRO Standard hash: md5(api|merchant_id|invoice|amount|payment_desc|currency).
  • PRO callback check: md5(api . trx_id . invoice_no . txn_status . msg) with no separators. trx_id is fpx_fpxTxnId, paypal_trx_id, mastercard_trx_id or others_trx_id.
  • Some PRO calls put merchant_id before the API key: requery, refunds, refund status.
  • LITE hash: sort all sent fields except hash by name, concatenate the values, remove spaces, then hash_hmac('sha256', s, API_KEY). Verify the callback the same way over the received fields.
  • Status codes:
    • PRO: 00 approved, 09 pending, 99 pending authorization (B2B).
    • LITE: 00 success, 11 failed, 22 pending, failed cancelled.
  • Amount limits: RM1.50 minimum and under RM30,000 (B2C). Amounts are strings with 2 decimals.
  • Callback retry: Betterpay resends at most 3 times every 10 minutes until it gets OK.
  • Rate limit: GET endpoints share 100 requests per 5 minutes per IP or account. Over the limit gives HTTP 429 {"response":"99",...}.
  • FPX refund API: only with your own FPX seller ID, max 10 per request, within 5 days. DuitNow QR refunds have their own endpoint.

Critical Rules

  • Keep the API key server-side. Never put it in the browser form. Compute the hash on the server.
  • Never mix PRO and LITE hashing or endpoints. Never mix sandbox and live keys.
  • Use the exact per-endpoint field order from the reference tables. Never guess an order.
  • Hash the plain values exactly as sent (the PHP samples urldecode each value). Send amounts as strings.
  • Never fulfil from the return URL or a client-side message. Fulfil only from a hash-verified backend callback or a requery.
  • Compare hashes in constant time. Then check that the invoice exists, the amount and currency match, and txn_status is the success code.
  • Make the callback handler idempotent and always reply plain OK once the callback is stored. Retries and duplicates happen.
  • Keep callback_url_be on the Whitelist Domain host, or the payment is rejected ("Invalid URL variable specified").
  • Each invoice must be unique per transaction. Retrying with the same invoice fails.
  • Treat endpoints marked "Not published" and the doc/Postman conflicts in the references as unconfirmed. Test in sandbox and confirm with support.

Completion Criteria

A Betterpay integration is done only when:

  1. The product (PRO/LITE), environment, host, merchant ID and API key come from config, never hardcoded.
  2. Payment creation and hashing run server-side with the documented field order (PRO) or sort rule (LITE).
  3. API Management has the callback URL, Whitelist Domain and return URLs for the right environment.
  4. The callback handler:
    1. verifies the hash over the documented input,
    2. checks invoice, amount, currency and txn_status,
    3. settles once,
    4. replies OK.
  5. Pending results (09, 99, 22) and missing callbacks are resolved by Get Payment Status, idempotently.
  6. Tests cover a bad hash, a replayed callback, a wrong amount, an unknown invoice, a failed/cancelled status, a pending status and a successful payment.
  7. Deployment docs list BETTERPAY_PRODUCT, BETTERPAY_ENV, BETTERPAY_BASE_URL, BETTERPAY_MERCHANT_ID, BETTERPAY_API_KEY and the callback/return URLs, with sandbox and live kept apart.

Loophole Review Loop

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

  1. List trust boundaries: browser form POST, hosted checkout, bank/e-wallet page, return URLs, backend creator, Betterpay API, callback receiver, database, fulfilment, refund job, API Management settings, plugin.
  2. Check bypasses:
    • fake return redirect, forged callback, hash built from parsed or re-encoded values
    • wrong field order, PRO/LITE mix, sandbox/live key mix
    • wrong amount or invoice, reused invoice
    • pending treated as paid, duplicate callback
    • missing OK causing retries, callback host not whitelisted
    • stale requery, refund replay, failed (cancel) treated as error-free
  3. Add fixes:
    • server-side hashing, local pending order first
    • constant-time compare, strict amount/invoice/status checks
    • durable callback log, idempotent settlement
    • separate env config, requery fallback, sandbox tests for every unconfirmed formula
  4. Re-read the relevant section of references/betterpay-api.md (or the recurring/tokenization/codes file) for any gap.
  5. State remaining uncertainty: production endpoint paths (behind login), LITE callback field set, LITE payment link hash conflict, plan-to-product mapping, enabled channels, refund eligibility, settlement timing.

Tệp đi kèm

Mô hình đọc các tệp này khi cần trong lúc kỹ năng được tải. Các tệp được cung cấp ở dạng có thể đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Setup Betterpay làm được gì?

Set up, build, debug, review, and explain Betterpay (formerly QlicknPay, Pay Direct Technology) payment integrations using official Betterpay docs, Postman collections and the WooCommerce plugin source, covering PRO and LITE accounts, Standard and Direct Payment, MD5 and HMAC-SHA256 hashing, callbacks, requery, FPX and DuitNow QR refunds, settlement reports, payment links, invoices, e-Mandate and card recurring, OCBC collection, card tokenization and pre-authorization. Use when working with Betterpay or QlicknPay Malaysia, FPX, DuitNow QR, cards, e-wallets, BNPL, IPP, callback verification,...

Vì sao nên dùng Setup Betterpay trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Setup Betterpay là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Setup Betterpay trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-betterpay. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Setup Betterpay?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Setup Betterpay với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Setup Betterpay với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Setup Betterpay có miễn phí không?

Kỹ năng này được afu-it phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇