Logo van Setup Betterpay

Setup Betterpay

Community
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.

Overzicht

Uitgeverafu-it
Repositorymalaysia-payment-gateway
Skillnaamsetup-betterpay
Sterren
74
Forks
11
Meegeleverde bestanden
7
Links
  • Instructies in Markdown

    Een SKILL.md-bestand dat het model laadt wanneer nodig, zodat het alleen tokens kost als een verzoek er daadwerkelijk bij past.

  • Werkt met elk LLM

    AI-skills zijn gewone Markdown, geen aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • 7 meegeleverde bestanden

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. Bestanden zijn alleen-lezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door afu-it op GitHub. Lees de broninhoud voordat je de skill installeert.

Installatie

Installeer de AI-skill Setup Betterpay in TypingMind om deze met elke LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map — het leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-betterpay
  4. Schakel de skill in elke chat in waarin je deze beschikbaar wilt hebben.
Plug-ins → Skills → Nieuwe skill → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

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
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Setup Betterpay in een willekeurige chat in TypingMind in en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek erbij past, laadt het model zelf de volledige instructies — je hoeft de skill nooit handmatig aan te roepen en deze kost pas tokens wanneer je de skill daadwerkelijk gebruikt.

Het model laadt Setup Betterpay automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Setup Betterpay niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

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.

Meegeleverde bestanden

Het model leest deze bestanden wanneer nodig terwijl de skill geladen is. Ze worden beschikbaar gesteld als leesbare bestanden en worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill 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,...

Waarom Setup Betterpay gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Setup Betterpay bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model, en je kunt midden in een chat van model wisselen zonder dat de skill niet meer werkt. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Setup Betterpay in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-betterpay. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Setup Betterpay gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Setup Betterpay gebruiken?

Zoveel als je wilt. Zolang een model skills ondersteunt, kun je Setup Betterpay ermee gebruiken: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama en meer. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Setup Betterpay gratis?

Deze skill is door afu-it op GitHub gepubliceerd. Bekijk de repository voor de licentievoorwaarden. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. Deze volgt het open Agent Skills-formaat: een bestand met de naam SKILL.md met een naam en beschrijving, plus eventuele scripts, sjablonen of referentiebestanden die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇