setup-senangpay

$npx mdskill add afu-it/malaysia-payment-gateway/setup-senangpay

Set up senangPay payment integrations using official guides and APIs

  • Identify user's need for setting up senangPay integration.
  • Refer to senangpay-api.md for API details, environment URLs, and roles.
  • Use account-setup.md for registration steps, key management, sandbox/live setup, and pricing information.
  • Utilize source-map.md for selecting appropriate senangPay guide pages based on user's requirements.

SKILL.md

.github/skills/setup-senangpayView on GitHub ↗
---
name: setup-senangpay
description: Set up, build, debug, review, and explain senangPay payment integrations using official senangPay guide pages, Manual Integration API, Direct API, callbacks, return URLs, query status APIs, refund API, sandbox/live setup, Merchant ID, Secret Key, Hash Type, shopping cart plugins, e-commerce integrations, recurring payments, payout API, tokenisation, split settlements, and DOKU migration references. Use when working with senangPay hosted checkout, payment forms, callbacks, SHA256/MD5 hash verification, Direct API client sessions, JavaScript Web SDK, FPX bank lists, refunds, package capabilities, sandbox testing, or senangPay dashboard setup.
---

# SenangPay

Use this skill for senangPay payment gateway integration work.

## Source

Read `references/senangpay-api.md` before giving factual API guidance or writing integration code. It contains source URLs, integration surfaces, environment URLs, endpoint roles, parameter rules, hash formulas, callback behavior, query APIs, Direct API, FPX bank list, refund API, and settlement/security cautions.

Read `references/account-setup.md` when user asks how to register, which credentials are needed, where keys come from, sandbox setup, dashboard setup, package capabilities, pricing, support, or migration context.

Read `references/source-map.md` when choosing which senangPay guide page applies to hosted checkout, Direct API, plugins, callbacks, query APIs, refunds, recurring, tokenisation, split settlement, payout, sandbox, or migration.

## Core Workflow

1. Identify environment: sandbox or production.
2. Identify integration surface: hosted/manual payment form, shopping cart plugin, e-commerce platform integration, Direct API, recurring payment, refund API, payout API, tokenisation, or split settlement.
3. Confirm credentials and dashboard setup: Merchant ID, Secret Key, Hash Type, Return URL, and Callback URL.
4. Create a local pending payment before sending the customer to senangPay.
5. Generate request hash server-side using the correct formula and account Hash Type.
6. Redirect to hosted checkout or create a Direct API client session server-side.
7. Treat Return URL as browser UX only; do not fulfil from return alone.
8. Verify callback/return hash server-side, requery order or transaction status when needed, then settle only after amount, order ID, status, merchant, environment, and provider transaction reference match.
9. Make settlement idempotent because senangPay can send multiple callbacks and later callbacks can supersede earlier statuses.

## Core Facts

- Production hosted checkout URL: `https://app.senangpay.my/payment/{merchant_id}`.
- Sandbox hosted checkout URL: `https://sandbox.senangpay.my/payment/{merchant_id}`.
- Hosted/manual checkout accepts GET or POST parameters.
- Hosted/manual checkout amount uses two decimal places, for example `25.50`.
- Direct API amount uses cents, for example `200` means RM 2.00.
- Manual request hash source sequence: `{secret_key}{detail}{amount}{order_id}`.
- Return/callback status values: `1` successful, `0` failed, `2` pending authorization.
- Return/callback verification source sequence: `{secret_key}{status_id}{order_id}{transaction_id}{msg}`.
- Query order status endpoint: `GET https://app.senangpay.my/apiv1/query_order_status`.
- Query transaction status endpoint: `GET https://app.senangpay.my/apiv1/query_transaction_status`.
- Direct API endpoints: `POST https://api.senangpay.my/payment/v3` and `POST https://api.sandbox.senangpay.my/payment/v3`.
- Direct API requires Enterprise package, authorised merchant access, and outgoing server IP whitelisting.
- Merchant ID and Secret Key are in Dashboard > Settings > Profile > Shopping Cart Integration Link.
- SHA256 is recommended. MD5 is legacy/deprecated and should only be used for systems that explicitly require it.
- Callback URL uses HTTP POST and must output exactly `OK` without HTML tags for successful receipt.

## Critical Rules

- Keep Secret Key and private hash inputs server-side only.
- Do not mark paid from Return URL, frontend event, SDK response, or browser redirect alone.
- Prefer SHA256/HMAC-SHA256 and avoid MD5 unless supporting an explicit legacy integration.
- Always verify hash with the exact sequence documented for the active flow.
- Verify local order, expected amount, status, transaction ID/reference, merchant ID, and environment before marking paid.
- Log callback events durably and make processing idempotent before returning `OK`.
- Expect duplicate callbacks for the same transaction.
- Expect pending or failed callbacks before a later successful callback; latest callback can be the most up-to-date status.
- Avoid callback redirects and session-dependent callback handlers.
- Separate sandbox and production credentials, URLs, callback URLs, Return URLs, and dashboard settings.
- For Direct API, never expose Secret Key in browser JavaScript and remember UUID is valid for only 60 seconds.
- For refund API, store local refund attempts and do not retry blindly after duplicate, partial-refund, refund-window, or amount-exceeded errors.
- If package capability, payment method availability, settlement timing, current pricing, IP whitelisting, migration behavior, or dashboard state matters, verify live senangPay dashboard/docs/support before claiming certainty.

## Loophole Review Loop

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

1. List trust boundaries: browser Return URL, backend checkout creator, senangPay hosted checkout, Direct API session endpoint, JavaScript SDK, callback receiver, query APIs, database, fulfilment job, refund job, dashboard settings, and package/channel activation.
2. Check bypasses: fake success return, forged callback, wrong hash type, wrong hash sequence, wrong amount format, wrong order ID, wrong merchant ID, sandbox/live mix, duplicate callback, failed callback followed by success, pending marked paid, stale Direct API UUID, Direct API Secret Key leak, unwhitelisted Direct API server IP, inactive FPX bank, duplicate refund request, partial refund unsupported, and refund after 180-day window.
3. Add fixes: server-side local pending payment, server-side hash generation, callback hash verification, status requery, strict amount/status/order checks, idempotency keys, callback event log, exact `OK` response after durable recording, environment-separated config, bank status filtering, package capability checks, and refund idempotency.
4. Re-read `references/senangpay-api.md` sections relevant to any gap.
5. State remaining uncertainty if it depends on current package, channel enablement, pricing, dashboard configuration, DOKU migration state, or senangPay support approval.

More from afu-it/malaysia-payment-gateway

SkillDescription
malaysia-payment-gatewayBuild, debug, review, and explain Malaysia payment gateway integrations. Use when implementing checkout, payment links, hosted payment pages, redirects, callbacks, webhooks, HMAC/signature verification, idempotent settlement, paid-access unlocking, refunds, reconciliation, sandbox/live setup, or provider switching for Malaysian gateways such as CHIP Collect, Curlec/Razorpay, Xendit Malaysia, Bayarcash, BCL Pay, toyyibPay, Billplz, FPX, DuitNow QR, cards, or e-wallets.
setup-bayarcashSet up, build, debug, and explain Bayarcash payment integrations using Bayarcash API docs, Web Impian API docs, Bayarcash PHP SDK, WordPress plugins, Boost.space integration links, and Bayarcash MCP server references. Use when working with Bayarcash API v2/v3, payment intents, FPX banks, DuitNow banks or wallets, portals, payment channels, callbacks/webhooks, checksums, transaction lookups, direct debit/e-Mandate flows, enterprise partner merchant/payout APIs, Laravel/PHP SDK usage, WordPress Bayarcash integrations, or Bayarcash MCP tooling.
setup-bclSet up, build, debug, review, and explain BCL payment gateway, BCL Pay, BCL Payment Link, BCL QR Terminal, BCL Forms, Bayarcash-linked setup, portal keys, transactions, webhooks, direct debit forms, client info, payment redirects, and BCL operating procedures using BCL docs.
setup-billplzSet up, build, debug, review, and explain Billplz payment integrations using Billplz API docs, help center, GitHub plugins, status pages, payment collections, payment forms, Payment Order payouts, X Signature callbacks/redirects, V5 checksums, sandbox/live setup, API Secret Key, Collection ID, and X Signature Key.
setup-chipSet up, build, debug, and explain CHIP Collect payment integrations using the official CHIP Collect API documentation. Use when working with CHIP Collect purchases, checkout URLs, payment links, direct post, FPX, DuitNow QR, cards, e-wallets, callbacks, webhooks, signature verification, clients, recurring tokens, subscriptions, pre-authorization, refunds, captures, releases, payment methods, statements, account balance, account turnover, API keys, Brand ID, or CHIP Collect endpoint schemas.
setup-curlecSet up, build, debug, review, and explain Razorpay Curlec payment gateway integrations using Curlec and shared Razorpay documentation. Use when working with Curlec/Razorpay Standard Checkout, FPX or redirect payment methods, Orders API, Payments API, Refunds API, Payment Links, Basic Auth API keys, checkout.js options, callback_url, payment signature verification, webhook setup, webhook HMAC validation, sandbox/test mode, payment capture, payment status reconciliation, or Malaysia payment gateway go-live checks.
setup-fiuuSet up, build, debug, review, and explain Fiuu payment integrations using official Fiuu API specs, Seamless Integration, Inpage Checkout, Mobile XDK, SDKs, and shopping cart plugin references. Use when working with Fiuu hosted payment pages, payment requests, vcode/skey verification, Return URL, Notify/Notification URL, Callback URL, IPN ACK/retry behavior, payment status requery, refunds, captures, recurring/token payments, channel status, mobile Flutter/Android/iOS/React Native XDK, JavaScript Seamless Integration, Inpage Checkout, WooCommerce, Magento, OpenCart, WHMCS, Shopify, or Fiuu account/dashboard setup.
setup-hitpaySet up, build, debug, review, and explain HitPay payment integrations using official HitPay docs, Payment Request API, hosted checkout, Drop-In UI, webhooks, HMAC-SHA256 signatures, sandbox/live setup, API keys, webhook salt, payment methods, plugins, refunds, recurring billing, payouts, platform APIs, and status page checks. Use when working with HitPay Malaysia, FPX, DuitNow, Touch 'n Go, cards, e-wallets, QR payments, Payment Links, API checkout, webhook settlement, refunds, or production readiness.
setup-stripe-malaysiaSet up, build, debug, review, and explain Stripe payment gateway integrations for Malaysia. Use when working with Stripe Checkout Sessions, Payment Intents, Payment Links, Elements, webhooks, Stripe.js, Stripe CLI, refunds, sandbox/live setup, MYR payments, cards, FPX, GrabPay, and production readiness.
setup-toyyibpaySet up, build, debug, review, and explain toyyibPay payment integrations using official toyyibPay API references, onboarding manuals, DuitNow QR notes, pricing/support pages, WooCommerce plugin notes, and WorkDo setup docs. Use when working with toyyibPay categories, bills, payment links, FPX, cards, DuitNow QR, callbacks, return URLs, MD5 callback verification, transaction lookups, inactive bills, sandbox/live setup, secret keys, category codes, WooCommerce setup, or ToyyibPay settlement checks.