payhere
/payhere
Expert knowledge of PayHere (payhere.lk), Sri Lanka's payment gateway, covering code integration AND account/support questions. Use whenever the user mentions PayHere, payhere.lk, sandbox.payhere.lk, md5sig, merchant secret, notify_url, payhere.js, "Sri Lankan payment gateway", LKR online payments, or wants to accept card, Genie, FriMi, HelaPay or Vishwa payments in Sri Lanka, even if they never say "PayHere" but describe the Checkout, Recurring, Preapproval, Charging, Retrieval, Subscription Manager, Refund, Authorize or Capture APIs. Covers hash/signature generation and callback verification
- Author
- psnwd ↗
- Repository
- getewise ↗
- Licence
- MIT
- Last repository change
- 13.11.2026
Assessment and security
- Files in this package
- 14
- Scripts
- 1
- HTML comments
- 0
- URLs in SKILL.md
- 4
No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 1 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: scripts/payhere_sign.py
What it does and when to use it
Expert knowledge of PayHere (payhere.lk), Sri Lanka's payment gateway, covering code integration AND account/support questions. Use whenever the user mentions PayHere, payhere.lk, sandbox.payhere.lk, md5sig, merchant secret, notify_url, payhere.js, "Sri Lankan payment gateway", LKR online payments, or wants to accept card, Genie, FriMi, HelaPay or Vishwa payments in Sri Lanka, even if they never say "PayHere" but describe the Checkout, Recurring, Preapproval, Charging, Retrieval, Subscription Manager, Refund, Authorize or Capture APIs. Covers hash/signature generation and callback verification
Triggers from the description
Original author description
Expert knowledge of PayHere (payhere.lk), Sri Lanka's payment gateway, covering code integration AND account/support questions. Use whenever the user mentions PayHere, payhere.lk, sandbox.payhere.lk, md5sig, merchant secret, notify_url, payhere.js, "Sri Lankan payment gateway", LKR online payments, or wants to accept card, Genie, FriMi, HelaPay or Vishwa payments in Sri Lanka, even if they never say "PayHere" but describe the Checkout, Recurring, Preapproval, Charging, Retrieval, Subscription Manager, Refund, Authorize or Capture APIs. Covers hash/signature generation and callback verification
How it works
- How to use this skill
- Routing table
- Core rules (the things most integrations get wrong)
- Working style
- Bundled files
SKILL.md preview
--- name: payhere description: Expert knowledge of PayHere (payhere.lk), Sri Lanka's payment gateway, covering code integration AND account/support questions. Use whenever the user mentions PayHere, payhere.lk, sandbox.payhere.lk, md5sig, merchant secret, notify_url, payhere.js, "Sri Lankan payment gateway", LKR online payments, or wants to accept card, Genie, FriMi, HelaPay or Vishwa payments in Sri Lanka, even if they never say "PayHere" but describe the Checkout, Recurring, Preapproval, Charging, Retrieval, Subscription Manager, Refund, Authorize or Capture APIs. Covers hash/signature generation and callback verification in Node/TypeScript, Go, Python, PHP/Laravel, Rust, Java and C#; JS and mobile SDKs (Android, iOS, React Native, Flutter); WooCommerce, OpenCart, Shopify, Magento, PrestaShop, WHMCS, CS-Cart, Moodle plugins; sandbox test cards; subscriptions, tokenized auto-charging, hold-on-card; plans, fees, limits, payouts, refunds, account approval; and debugging errors like "Unauthorized payment request" or PH-0022. --- # PayHere PayHere (PayHere (Pvt) Ltd) is a CBSL-approved payment gateway for Sri Lankan businesses. This skill packs its public knowledge base (support.payhere.lk, read Oct 2026) into focused reference files so you can write correct integrations and answer account questions without guessing. ## How to use this skill 1. Identify what the user is doing, using the routing table. 2. Read only the matching reference file(s); they hold exact parameter names, URLs and gotchas. 3. When writing code, start from `references/code-examples.md` (signing/verification) and `references/code-rest-api.md` (OAuth REST calls); adapt to the user's stack and framework. 4. Use `scripts/payhere_sign.py` to compute or check a hash/md5sig when debugging a mismatch. 5. Money, plan, fee and policy facts can change. State that the figures come from PayHere's docs as of late 2026 and point to support@payhere.lk / the 24x7 helpline (0115 339 339) for anything contractual. ## Routing table | User needs | Read | |---|---| | One-time web payment (redirect form), hash, notify_url, md5sig | `references/checkout-api.md` | | Subscriptions, recurring billing, preapproval/tokenization | `references/recurring-preapproval.md` | | OAuth token, Charging, Retrieval, Subscription Manager, Refund, Capture, Authorize APIs | `references/merchant-api.md` | | Popup/onsite checkout on a website (`payhere.js`) | `references/js-sdk-onsite.md` | | Android, iOS, React Native, Flutter apps | `references/mobile-sdks.md` | | WooCommerce / Shopify / OpenCart / Magento / PrestaShop / WHMCS / CS-Cart / Moodle / ShopHere | `references/plugins.md` | | Test cards, sandbox vs live | `references/sandbox-testing.md` | | Code in Node/TS, Go, Python, PHP/Laravel, Rust, Java, C# | `references/code-examples.md`, `references/code-rest-api.md` | | Applying for an account, plans/fees/limits, payouts, USD payouts, refunds policy, Links/Buttons, required policy pages | `references/account-business.md` | | Any error, mismatch, "why isn't notify firing", security review, doc contradictions | `references/troubleshooting.md` | | App uses several gateways: env layout, callback routes, shared idempotent settle | `references/multi-provider.md` | ## Core rules (the things most integrations get wrong) 1. **Server-side hash.** `hash = UPPER(md5(merchant_id + order_id + amount + currency + UPPER(md5(merchant_secret))))`, amount as `1000.00` (2 decimals, no commas). Never compute it in the browser or app; it would expose the secret. (Required since 2023-01-16.) 2. **Verify every notification.** PayHere POSTs form-encoded data to `notify_url`. Recompute `md5sig = UPPER(md5(merchant_id + order_id + payhere_amount + payhere_currency + status_code + UPPER(md5(secret))))` from the received strings, constant-time compare, then check `status_code` (2 success; for Authorize 3 = authorized), and check amount/currency/order against your DB. Redirects to `return_url` and JS-SDK `onCompleted` are not proof of payment. Notify is sent **once** and not redelivered (no re-send API), so also run a scheduled `GET /merchant/v1/payment/search?order_id=` reconciliation sweep. 3. **Per-domain secrets.** Merchant ID is per account; Merchant Secret is per registered domain/app (approval up to ~24 h). Sandbox and live are fully separate (different credentials, cannot be converted). 4. **Right URLs.** Live checkout is `https://www.payhere.lk/pay/checkout` (keep `www`; dropping it may cause PH-0022); sandbox is `https://sandbox.payhere.lk/pay/checkout`. Preapprove and authorize use `/pay/preapprove` and `/pay/authorize`; recurring has no URL of its own and posts to `/pay/checkout`. REST APIs live under `/merchant/v1/`. 5. **notify_url must be public.** localhost never works; tunnel for dev. Exempt the route from CSRF/auth; parse form bodies, not JSON. 6. **REST API auth** = API key (App ID/Secret) > Basic auth > Bearer token (~10 min) ; max 20 requests / 10 s; live needs whitelisted domain and server IP (email support@payhere.lk). Keep App Secret off clients. 7. **Plan gates features.** Recurring needs PLUS or higher; automated charging (preapproval + Charging API) needs PREMIUM; LITE is one-time LKR/USD only. Check `account-business.md` before designing around a feature. 8. **Hash exceptions.** Preapproval with no amount hashes `10.00` (LKR) / `0.51` (other currencies); recurring with a future `recurring_start_date` hashes `10.00` (LKR) / `0.50` (other) while still submitting the real amount. ## Working style - **Env files:** for several providers, one block per provider under a banner, **two blank lines between blocks**, every var prefixed (`PAYHERE_*`, `ONEPAY_*`, `WEBXPAY_*`, `GENIE_*`, `KOKO_*`), host/base URL first so sandbox vs live is obvious. Only vars the generated code reads; empty placeholders, never real keys. If the user names no provider, include a block for all five. Shape: ``` # ============================ PayHere ============================ PAYHERE_HOST=https://sandbox.payhere.lk PAYHERE_APP_ID= PAYHERE_APP_SECRET= # ============================ Koko =============================== KOKO_HOST=https://qaapi.paykoko.com KOKO_MID= KOKO_API_KEY= KOKO_PRIVATE_KEY_PEM= ``` - When the user's goal is ambiguous (redirect vs popup vs mobile, one-time vs subscription vs on-demand), pick from the routing table by asking one short question or by stating the assumption and proceeding. - Prefer showing a complete minimal flow: create order > server hash > form/popup > notify handler with verification > idempotent DB update > status page from DB. - If the user's stack is not one of the seven covered, adapt the algorithm (MD5, uppercase hex) and say which part you adapted. - Flag documented contradictions (listed in `troubleshooting.md` section 5) rather than silently picking one. - If something isn't in the references, say so and suggest confirming with PayHere support rather than inventing parameters. - Never put real merchant secrets, App Secrets, or customer tokens into code you output; use env vars. ## Bundled files - `references/`: the topic files above - `scripts/payhere_sign.py`: CLI to generate the request hash (including preapproval and future-start variants) and verify a notification md5sig
Files in this package (14)
- SKILL.md 7 KB
- references/account-business.md 9 KB
- references/checkout-api.md 4 KB
- references/code-examples.md 10 KB
- references/code-rest-api.md 8 KB
- references/js-sdk-onsite.md 3 KB
- references/merchant-api.md 8 KB
- references/mobile-sdks.md 4 KB
- references/multi-provider.md 2 KB
- references/plugins.md 3 KB
- references/recurring-preapproval.md 4 KB
- references/sandbox-testing.md 2 KB
- references/troubleshooting.md 7 KB
- scripts/payhere_sign.py 4 KB
Versions
The database has no other skills named payhere.
Database snapshot: 13.11.2026 · package version 8ba2e1006042 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 3 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100gatewise
Router for the Gatewise payment gateway skills (PayHere, OnePay, WebXPay, Genie Business, Koko). Use when the user wants to accept payments in Sri Lanka (LKR) but has not named a gateway, asks which gateway or provider to use, compares gateways, wants more than one gateway in… - 100onepay
Expert knowledge of OnePay (onepay.lk, docs.onepay.lk), the Sri Lankan payment gateway, covering code integration AND account/support questions. Use whenever the user mentions OnePay, onepay.lk, api.onepay.lk, /v3/checkout/link, onepay_transaction_id, ipg_transaction_id,… - 100sri-lanka-vat
Use this skill whenever asked to prepare, review, or classify transactions for a Sri Lanka VAT return for any client. Trigger on phrases like \"Sri Lanka VAT\", \"IRD return\", \"CGIR filing\", or any request involving Sri Lanka VAT. MUST be loaded alongside vat-workflow-base… - 100sri-lanka-corporate-tax
ALWAYS read this skill before touching any Sri Lanka corporate income tax work. Use whenever asked about Sri Lanka company tax for a resident company. Trigger on phrases like \"Sri Lanka corporate tax\", \"Sri Lanka CIT\", \"company tax Sri Lanka\", \"30% corporate rate Sri… - 90domain-payments
Payments and e-wallet domain knowledge for Business Analysts - glossary, core processes (merchant onboarding, wallet and KYC levels, top-up, withdrawal, P2P, online/QR payment, refund and chargeback, settlement, reconciliation), business rules (wallet limits by KYC level,… - 100payment-gateway-integration
Integrate a payment provider with idempotent charges, signature-checked webhooks, and an explicit map from provider states to order states. Use when adding or changing checkout payment, capture, refund, or payment notification handling.