Setup Leanx logo

Setup Leanx

Community
afu-it
setup-leanx

Set up, build, debug, review, and explain LeanX (Lean.x, Leanis Solutions) payment integrations using official LeanX docs, auth-token header, optional X-Signature HMAC-SHA256 request signing, Collections and Bills, hosted payment page (create-bill-page), own-page silent bills (create-bill-silent) with payment_service_id, FPX B2C/B2B, cards, e-wallets, DuitNow QR, BNPL, JWT-encoded callbacks decoded with the Hash Key, manual-checking-transaction status requery, payouts via DuitNow, bank account validation, pool balance, WooCommerce/OpenCart plugins, the Credit Card JS library, sandbox (api.leanx.dev) vs production (api.leanx.io). Use when working with LeanX checkout, FPX, DuitNow QR, e-wallet or card collection, payout disbursement, callback settlement, or production readiness.

Overview

Publisherafu-it
Repositorymalaysia-payment-gateway
Skill namesetup-leanx
Stars
74
Forks
11
Bundled files
4
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by afu-it on GitHub. Read the source before you install it.

Installation

Install the Setup Leanx AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-leanx
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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-leanx .claude/skills/setup-leanx
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Setup Leanx in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Setup Leanx on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Setup Leanx is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

LeanX Payment Gateway

Use this skill for LeanX (Lean.x) payment collection and payout integration work.

Source

Read references/leanx-api.md before giving factual API guidance or writing integration code. It holds the endpoint catalogue, base URLs, auth header, X-Signature algorithm, bill creation fields, payment service list, callback JWT format, status API, payout flow, error codes, and documented inconsistencies.

Read references/account-setup.md when the user asks how to register, where the Auth Token / UUID / Hash Key live, sandbox vs production portals, env var names, plugin setup, payout pool funding, or pricing.

Read references/source-map.md to pick the official docs page for a topic and to see docs coverage.

Core Workflow

  1. Identify environment: sandbox (https://api.leanx.dev) or production (https://api.leanx.io).
  2. Identify surface: hosted payment page (create-bill-page), own bank-selection page (list-payment-services + create-bill-silent), DuitNow QR (silent bill with QR metadata), card form (Credit Card JS library), plugin, or payout.
  3. Confirm portal setup: API key created and enabled, Auth Token, UUID, Hash Key, a Collection UUID, X-Signature on or off, production IP whitelist if used.
  4. Create a local pending payment with your own unique invoice_ref before calling LeanX.
  5. Create the bill server-side with the auth-token header (plus x-signature, x-timestamp, x-nonce when X-Signature is enabled).
  6. Redirect the customer to the returned URL (data.redirect_url for the payment page, data.payment_url for a silent bill) or render the QR from data.metadata.
  7. Treat redirect_url as browser UX only; never fulfil from it.
  8. Receive the callback ({"data": "<JWT>", "response_code": 2100}), verify and decode the HS256 JWT with the Hash Key, then requery manual-checking-transaction.
  9. Settle idempotently only after invoice number, invoice_ref, amount, invoice_status == "SUCCESS", environment and merchant match.
  10. Run a requery job for pending bills: callbacks are sent only for successful payments, so failures and missed callbacks are found only by polling.

Core Facts

  • Production API base https://api.leanx.io; sandbox https://api.leanx.dev. All paths are under /api/v1/merchant/....
  • Auth: header auth-token: <MERCHANT_ID>|<UUID>|<secret> (the full Auth Token string from the portal API page). The token is static.
  • Optional X-Signature: HMAC-SHA256 (hex) over HTTP_METHOD|UUID|URL_PATH|TIME_STAMP|AUTH_TOKEN|NONCE keyed with the Hash Key; send x-signature, x-timestamp (Unix seconds), x-nonce (UUID4). Valid 5 minutes.
  • Hosted page: POST /api/v1/merchant/create-bill-page (optional query invoice_no). Own page: POST /api/v1/merchant/create-bill-silent with payment_service_id.
  • Every bill needs a collection_uuid; one collection can be reused indefinitely.
  • amount is Decimal(10,2) in MYR ringgit (for example 10.00), not sen.
  • Payment service list: POST /api/v1/merchant/list-payment-services with payment_type, payment_status, payment_model_reference_id (1 = B2C/default, 2 = FPX B2B).
  • Payment types: WEB_PAYMENT (FPX), CI_VISA_MASTERCARD, GLOBAL_CARD_PAYMENT, DIGITAL_PAYMENT (e-wallet), BUY_NOW_PAY_LATER, SWITCH_PAYPAL, GLOBAL_CARD_PAYMENT_STRIPE, DUITNOW_ONLINE_BANKING, QR_PAYMENT (DuitNow QR).
  • Callback body is JSON {"data": "<HS256 JWT>", "response_code": 2100}; decode with the Hash Key. Sent only for successful transactions; retried up to 3 times unless you return HTTP 200.
  • Status requery: POST /api/v1/merchant/manual-checking-transaction?invoice_no=<bill invoice_no or your invoice_ref>. LeanX calls this method recommended over the callback.
  • Bill statuses seen: SUCCESS (invoice_status_id 2), PENDING (1), FAILED; plugins also treat FPX_STOP_CHECK_FROM_PS and SENANGPAY_STOP_CHECK_FROM_PS as failed.
  • Success envelope: response_code: 2000, description: "SUCCESS"; errors use numeric codes such as 4008 Invalid HMAC signature, 5688 Invalid Token, 4626 Bill Invoices Already Exist.
  • Refunds, recurring billing and tokenisation are not documented in the public API docs (checked 2026-10-21).
  • Payouts: POST /api/v1/merchant/create-payout-invoice from a prefund pool (virtual_pool_reference), RM2.00 minimum pool balance, status via get-payout-transaction-by-id.
  • Production supports an IP whitelist feature; sandbox does not. IP addresses are not published.

Critical Rules

  • Keep Auth Token and Hash Key server-side only; the Hash Key both signs requests and verifies callbacks.
  • Do not mark paid from redirect_url, browser state, or the card library result.
  • Verify the callback JWT locally with a JWT library pinned to HS256 and the Hash Key; reject any other alg. Do not post the Hash Key to a remote decode endpoint.
  • After decoding, confirm with manual-checking-transaction before settling; compare amount as a decimal string.
  • Generate a unique invoice_ref per attempt; duplicates return 4626 or 3614.
  • Respond HTTP 200 to callbacks only after durable processing; make processing idempotent across the 3 retries.
  • Use matching base URL, Auth Token, Hash Key, Collection UUID and payment service IDs per environment; service IDs differ between sandbox and production (card is 1100 in production).
  • Refresh the payment service list daily rather than hardcoding bank IDs.
  • For payouts, validate the account first, key status checks by external_invoice_ref, and treat PENDING / STATUS_PENDING_APPROVAL as non-final.

Completion Criteria

A LeanX integration is done only when:

  1. Bill creation runs server-side with auth-token (and X-Signature headers if enabled) and a unique invoice_ref.
  2. Redirect handling only triggers a status requery; it never fulfils directly.
  3. Callback handler verifies the HS256 JWT with the Hash Key, rejects bad signatures, and returns 200 only after persistence.
  4. Settlement checks invoice number, invoice_ref, amount, invoice_status, environment and merchant before marking paid.
  5. A scheduled requery resolves pending bills to SUCCESS or FAILED, since failed payments send no callback.
  6. Tests cover invalid JWT, wrong alg, duplicate callback, wrong amount, unknown invoice, FAILED and PENDING status, and success.
  7. Deployment docs list LEANX_API_URL, LEANX_AUTH_TOKEN, LEANX_UUID, LEANX_HASH_KEY, LEANX_COLLECTION_UUID, callback URL, redirect URL, and sandbox/live separation.

Loophole Review Loop

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

  1. List trust boundaries: browser redirect, payment page, own bank-selection page, QR page, card library, backend bill creator, LeanX API, callback receiver, JWT verifier, database, requery job, payout job, portal settings.
  2. Check bypasses: fake redirect, forged callback, JWT with alg: none or wrong key, Hash Key leaked to a remote decoder, sandbox/live key mix, wrong collection, reused invoice_ref, amount mismatch, stale or missing callback, failed payment never reported, duplicate payout, payout to wrong account name, insufficient pool balance, X-Signature clock skew.
  3. Add fixes: local pending record first, server-side bill creation, local HS256 verification, status requery before settlement, decimal amount compare, unique refs, idempotent updates, scheduled requery, bank validation before payout, NTP-synced clock.
  4. Re-read the relevant sections of references/leanx-api.md, including "Documented inconsistencies".
  5. State remaining uncertainty: callback JWT key encoding, exact URL_PATH for signed requests with query strings, refund process, settlement timing, enabled payment services, and IP whitelist values must be confirmed with LeanX or in sandbox.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Setup Leanx AI skill do?

Set up, build, debug, review, and explain LeanX (Lean.x, Leanis Solutions) payment integrations using official LeanX docs, auth-token header, optional X-Signature HMAC-SHA256 request signing, Collections and Bills, hosted payment page (create-bill-page), own-page silent bills (create-bill-silent) with payment_service_id, FPX B2C/B2B, cards, e-wallets, DuitNow QR, BNPL, JWT-encoded callbacks decoded with the Hash Key, manual-checking-transaction status requery, payouts via DuitNow, bank account validation, pool balance, WooCommerce/OpenCart plugins, the Credit Card JS library, sandbox (api.l...

Why use Setup Leanx on TypingMind?

Because you install it once and use it with any model. Setup Leanx is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Setup Leanx in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-leanx. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Setup Leanx?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Setup Leanx?

As many as you like. As long as a model supports skills, you can use Setup Leanx with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Setup Leanx AI skill free?

It is published on GitHub by afu-it. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇