Use this skill for Maybank2u Pay Online Banking Payment Gateway integration work (customer pays from a Maybank current or savings account through a Maybank2u pop-up).
Source
Read references/maybank2u-pay-api.md before giving factual guidance or writing integration code. It holds the endpoint catalogue, send-string format, the exact encryption algorithm, environments, front-end pop-up, Realtime Payment Notification (RPN) fields, the RPN acknowledgement contract, redirect callback parameters, IPs, and gotchas found in the SDK source.
Read references/account-setup.md when the user asks how to apply, which documents are needed, where the Payee Code comes from, how UAT sign-off works, Response URL and SSL certificate requirements, reporting portals, settlement, or the Cards Payment Gateway (Maybank eBPG).
Read references/source-map.md to pick the right official page or SDK file, and for coverage notes.
Core Workflow
- Identify environment:
envType0 playground, 1 UAT, 2 production. - Confirm the merchant has a Payee Code for that environment and has submitted the Payment Notification Technical Requirement (Response URL, port, SSL certificate) in the Maybank2u Pay portal.
- Create a local pending payment with a unique reference before building the send string.
- Server-side, build the send string and encrypt it exactly as the SDK does; return
encryptedStringandactionUrlto the page. - On the payment page, call
m2upay.initPayment(encryptedString, actionUrl, 'OT')directly from a user click so the pop-up is not blocked. - Treat the pop-up result and any
Callbackurlredirect as UX only. - Settle from the RPN: HTTP POST JSON from Maybank to the Response URL, from Maybank's documented IP, matched on
AcctIdandAmt(cents). - Reply to every RPN with JSON
{"Msg":{"PmtType":...,"RefId":...,"StatusCode":"0"}}(or-1,101,104). - Settle idempotently on
RefId; duplicate RPNs return104. - Reconcile against the Daily Payment Summary Report and Payment Raw Data File in the Maybank Payee Report Portal; there is no public status-query API.
Core Facts
- Official docs:
https://m2upay.maybank2u.com.my/assets/sdk/index.html(single page) plus SDK zips for Java, JavaScript and PHP. - Production action URL:
https://www.maybank2u.com.my/mbb/m2u/m9006_enc/m2uMerchantLogin.do. - UAT action URL in all three SDKs:
https://202.162.18.55:8443/testM2uPayment; playground:https://api.discotech.io/v1.0/testM2uPayment. - Request inputs:
amount(decimal ringgit, e.g.100.00, length 9),accountNumber(your invoice/bill ref, alphanumeric, 30),payeeCode(numeric, 3), plus SDK-onlyrefNumberandcallbackUrl. - Send string:
Login$<payeeCode>$1$<amount>$1$<refNumber>$1$<accountNumber>$<callbackUrl>(empty-field variants in the API reference). - Encryption: twice,
v = base64(AES-128-ECB-PKCS7(key, "Maybank2u simple encryption" + v)), key bytes00 01 02 ... 0f, then URL-encode. Key and salt are public in every SDK, so this is obfuscation, not integrity. - Front end posts a form to
actionUrlinto a pop-up namedM2UPaymentwith fieldsq(encrypted string) andi(sub-service,OTin docs and samples). - RPN: JSON
MsgwithPmtType(CashPaymentorCCardPayment),RefId,TrnDateTime(YYYYMMDDhhmmss),AcctId,Amt(cents),StatusCode(00success,01unsuccessful),StatusDesc. - RPN is UAT and production only; the playground does not send it.
- RPN source IPs: UAT
202.162.18.247, production202.162.17.179. - RPN reply codes:
-1internal error (resend),0OK,101rejected by merchant,104duplicate.998and999are reserved for the bank. - The RPN carries no signature, hash or HMAC field (checked 2026-10-21).
- Response URL changes take 5 working days to take effect.
- No refund, requery, recurring or tokenisation API is documented (checked 2026-10-21).
Critical Rules
- Build and encrypt the send string server-side only; never let the browser choose
amount,payeeCodeoraccountNumber. - Do not trust the encrypted string for integrity: anyone can decrypt and re-encrypt it with the public key.
- Do not mark paid from the pop-up, the
Callbackurlredirect, or front-end JavaScript. - Accept RPN only over HTTPS at the registered Response URL, only from the documented Maybank IP for that environment.
- Match
AcctIdto a pending local order andAmt(cents) to the expected amount before settling; Maybank's own Java guide calls this mandatory. - Make
RefIdunique in the database; reply104for repeats, never double-fulfil. - Return
-1only when you want Maybank to resend (for example your database is down). - Keep
accountNumberfree of$because$is the send-string delimiter (inference from the format; not stated by Maybank). - Swap the UAT Payee Code for the production Payee Code and
envType2 together at go-live. - PHP SDK uses
mcrypt, removed in PHP 7.2; port toopenssl_encryptwith identical output, and confirm in UAT.
Completion Criteria
A Maybank2u Pay integration is done only when:
- Send string and encryption run server-side and match the official SDK output byte for byte.
- Pop-up opens from a direct user click and posts
qandito the correctactionUrlfor the environment. - Response URL, port and SSL certificate are registered for UAT and production in the portal.
- RPN handler checks source IP, parses JSON
Msg, matchesAcctIdandAmt, checksStatusCode00, and replies with the documented JSON. - Duplicate RPNs return
104; failures return101; transient errors return-1. - Tests cover wrong IP, unknown
AcctId, wrong amount,01status, duplicateRefId, and success. - UAT screenshots (pop-up and RPN received) are uploaded and UAT is confirmed in the portal.
- Deployment docs list
M2UPAY_PAYEE_CODE,M2UPAY_ENV_TYPE, Response URL, and allowed RPN IP per environment.
Loophole Review Loop
When asked whether a Maybank2u Pay strategy is "100% confident", run this loop until no factual gaps remain:
- List trust boundaries: checkout page, encryption endpoint, pop-up, Maybank2u login/TAC, Callbackurl redirect, RPN receiver, firewall, database, fulfilment job, payee report portal.
- Check bypasses: tampered amount re-encrypted with the public key, fake redirect, forged RPN from a non-Maybank IP, RPN for an unknown or already-paid
AcctId, amount in ringgit vs cents mix-up, duplicate RPN, RPN lost while returning0, UAT payee code in production, popup blocked, PHP mcrypt missing, Java line-wrapped Base64 mismatch. - Add fixes: server-only send string, strict IP allowlist, amount and reference match, unique
RefId, durable event log, correct reply codes, daily report reconciliation, environment-specific config. - Re-read
references/maybank2u-pay-api.mdsections relevant to any gap. - State remaining uncertainty: no RPN signature, no documented requery or refund API,
ivalues other thanOT,refNumberandcallbackUrlusage, current UAT URL, and current IPs must be confirmed with Maybank (maybank2upay@maybank.com).