setup-toyyibpay

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

Integrate toyyibPay payment gateway using official API and docs.

  • Set up categories, bills, payment links, FPX, cards, and DuitNow QR.
  • Depends on toyyibPay API, secret keys, category codes, and sandbox/live environments.
  • Reads official API references, onboarding manuals, and WooCommerce plugin notes.
  • Generates integration code, debug steps, and configuration guidance for developers.

SKILL.md

.github/skills/setup-toyyibpayView on GitHub ↗
---
name: setup-toyyibpay
description: Set 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.
---

# toyyibPay Payment Gateway

Use this skill for toyyibPay payment gateway integration work.

## Source

Read `references/toyyibpay-docs.md` before giving factual API guidance or writing integration code. It contains source URLs, environment bases, endpoint map, callback hash rules, amount units, DuitNow QR fields, dashboard setup notes, pricing/support notes, WooCommerce setup notes, and WorkDo configuration notes from the provided docs plus follow-up source checks.

Read `references/account-setup.md` when user asks how to register, which API keys are needed, where credentials come from, or what dashboard setup is required.

## Core Workflow

1. Identify environment: sandbox at `dev.toyyibpay.com` or production at `toyyibpay.com`.
2. Confirm credential scope: User Secret Key, Category Code, and optional Enterprise User Secret Key.
3. Create or reuse a toyyibPay Category, then create local pending payment before creating a Bill.
4. Create Bill server-side with fixed amount in cents, internal reference in `billExternalReferenceNo`, return URL, and callback URL.
5. Redirect customer to `https://toyyibpay.com/{BillCode}` or sandbox equivalent.
6. Verify callback hash with `MD5(userSecretKey + status + order_id + refno + "ok")`.
7. Re-check payment using `getBillTransactions` when possible, then settle idempotently after status, amount, channel, provider, and reference match.

## Core Facts

- Production API base: `https://toyyibpay.com/index.php/api/`
- Sandbox API base: replace `toyyibpay.com` with `dev.toyyibpay.com` and use sandbox credentials.
- Requests are `POST`; docs accept `multipart/form-data` or `application/x-www-form-urlencoded`.
- `billAmount` uses cents, for example `100` equals RM 1.00.
- Main flow: `createCategory` -> `createBill` -> hosted bill URL -> callback/return -> `getBillTransactions`.
- Payment status values in callbacks/return URLs: `1` success, `2` pending, `3` fail.
- `getBillTransactions` status filter values: `1` successful, `2` pending transaction, `3` unsuccessful, `4` pending.
- DuitNow QR requires account activation, `enableDuitNowQR=1`, and `chargeDuitNowQR` set when enabled.
- WorkDo-style setup usually needs Secret Key and Category Code.

## Critical Rules

- Keep User Secret Key and Enterprise User Secret Key server-side only.
- Do not trust Return URL parameters for fulfilment; treat them as browser UX only.
- Reject callbacks when `hash` does not match the documented MD5 formula.
- Treat `order_id` as local external reference from `billExternalReferenceNo`; verify it maps to exactly one local pending payment.
- Verify callback `amount` and/or fetched `billpaymentAmount` against local expected amount before marking paid.
- Callback URL cannot be localhost; use public HTTPS or a tunnel for testing.
- Do not enable dynamic amount bills (`billPriceSetting=0`) for fixed-price orders unless local settlement can validate allowed amount.
- Do not invent payment channel availability, fees, card support, DNQR activation, settlement timing, or package limits. Verify live portal or current docs when these matter.

## Loophole Review Loop

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

1. List every trust boundary: browser return, backend checkout route, toyyibPay Bill API, callback receiver, database, fulfilment job, dashboard settings, and settlement report.
2. Check each bypass: fake success return, forged callback, MD5 hash mismatch, wrong order reference, wrong amount, wrong status, duplicated callback, pending marked as paid, dynamic amount over/underpayment, inactive/expired bill, sandbox/live credential mix, DNQR disabled account, missing public callback URL, and split-payment side effects.
3. Add fixes for each bypass: server-side Bill creation, local pending payment first, callback hash verification, transaction re-fetch, unique provider reference, strict amount/status checks, idempotent fulfilment, environment-separated config, expiry handling, and audit logs.
4. Re-read `references/toyyibpay-docs.md` sections relevant to any gap.
5. State remaining uncertainty explicitly if it depends on current account activation, dashboard package, payment channel enablement, pricing, settlement timing, or WorkDo product-specific settings.

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