Logo Setup Tng Ewallet

Setup Tng Ewallet

Cộng đồng
afu-it
setup-tng-ewallet

Set up, build, debug, review, and explain Touch 'n Go eWallet (TNG Digital, TNGD) payment integrations using official TNGD Mini Program Open API docs and the TNGD WooCommerce plugin source, covering /v1/payments/pay cashier and agreement payments, my.tradePay, notifyPayment callbacks, inquiryPayment, refund and inquiryRefund, applyToken/prepare/cancelToken auto debit, RSA256 request and response signatures, Alipay+ style web acquiring (order create/query/refund), sandbox vs production credentials, SFTP settlement files, and partner onboarding. Use when working with Touch 'n Go eWallet, TNG eWallet, TNGD mini programs, TNG cashier redirect, MYR e-wallet checkout, auto debit, payment notification handling, refunds, reconciliation, or production readiness.

Tổng quan

Nhà phát hànhafu-it
Kho mãmalaysia-payment-gateway
Tên kỹ năngsetup-tng-ewallet
Sao
74
Bản fork
11
Tệp đi kèm
5
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 5 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được afu-it công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Setup Tng Ewallet trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-tng-ewallet
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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-tng-ewallet .claude/skills/setup-tng-ewallet
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Setup Tng Ewallet trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Setup Tng Ewallet ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Setup Tng Ewallet với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Touch 'n Go eWallet (TNG Digital)

Use this skill for direct Touch 'n Go eWallet merchant integrations with TNG Digital Sdn Bhd (TNGD).

Source

Read references/tng-ewallet-api.md before giving factual API guidance or writing integration code. It holds the Mini Program Open API: message structure, RSA256 signing and verification, endpoint catalogue, full field tables for pay, inquiryPayment, notifyPayment, refund, inquiryRefund, authorization and user info APIs, data dictionary, result codes, my.tradePay and my.getAuthCode, and the SFTP settlement file.

Read references/tng-ewallet-web-acquiring.md when the merchant wants a website checkout (no mini program). It documents the alipayplus.acquiring.* API as implemented by the TNGD WooCommerce plugin, the only public source for that flow, and lists its gaps.

Read references/account-setup.md for onboarding, credentials, sandbox vs production, env vars, settlement, and pricing links.

Read references/source-map.md to pick the right official page and to see coverage and what is partner-only.

Core Workflow

  1. Identify the surface: TNGD Mini Program (Open API + my.tradePay), website or app checkout (web acquiring API), auto debit (agreement pay), or no-code (Payment Link, QR). No-code needs no API work.
  2. Confirm onboarding is done. TNGD issues Client-Id, Partner ID (Merchant ID), product code, TNGD public key, API host, and SFTP access by email after sandbox UAT. There is no self-serve API key page.
  3. Generate an RSA key pair; give TNGD the public key; keep the private key server-side.
  4. Create a local pending payment with a unique paymentRequestId (mini program) or merchantTransId (web) before calling TNGD.
  5. Call the create API server-side with a signed request. Verify the response signature with the TNGD public key.
  6. Mini program: pass actionForm.redirectionUrl to my.tradePay({ paymentUrl }). Web: redirect the browser to checkoutUrl.
  7. Treat my.tradePay result codes and the browser return URL as UX only.
  8. Handle the payment notification: verify the signature, check IDs and amount, acknowledge with a signed resultStatus: "S" response at once, then process async and idempotently.
  9. If no final notification arrives, query status (inquiryPayment or order.query). Never settle from U or PROCESSING.
  10. Reconcile daily against the T+1 SFTP settlement CSV.

Core Facts

  • Open API URL pattern: https://{host}/acl/api/{restful_path}, for example /v1/payments/pay. TNGD assigns the host; production endpoints are sent by email.
  • Every Open API call is POST with JSON body and headers Client-Id, Request-Time (RFC3339, millisecond precision), Signature.
  • Signature header: Signature: algorithm=RSA256, keyVersion=<n>, signature=<value>. RSA256 (SHA256withRSA) is default; ECC224 is also listed.
  • String to sign: POST <HTTP_URI>\n<Client-Id>.<Request-Time>.<HTTP_BODY>. Responses are verified with <Client-Id>.<Response-Time>.<HTTP_BODY> and the TNGD public key.
  • Signing is mandatory for all requests and responses, including your acknowledgement of notifyPayment.
  • Amounts are {currency, value} with value a string integer in the smallest unit (sen). RM100.00 is "10000".
  • Cashier payment: productCode 51051000101000100001, paymentFactor.isCashierPayment: true. Agreement pay: productCode 51051000101000100031, paymentFactor.isAgreementPay: true, paymentAuthCode = access token.
  • resultStatus: S success, F failed, U unknown, A accepted (follow actionForm).
  • inquiryPayment paymentStatus: SUCCESS, FAIL, PROCESSING, CANCELLED. Poll every 5 s for up to 1 minute.
  • my.tradePay result codes: 9000 success, 8000 processing, 4000 failed, 6001 user cancel, 6002 network error, 6004 unknown.
  • Mini program calls need extendInfo with customerBelongsTo (for example "{\"customerBelongsTo\":\"TNG\"}").
  • Idempotency keys: partnerId + paymentRequestId for pay, partnerId + refundRequestId for refund.
  • Settlement is T+1 to the bank account given at onboarding; CSV MERCHANT_SETTLEMENT_<PartnerID>_<yyyymmdd> is on SFTP at 9 AM T+1.
  • Web acquiring sandbox base (plugin default): https://api-sd.tngdigital.com.my; paths /alipayplus/acquiring/order/create.htm, /order/query.htm, /order/refund.htm, /refund/query.htm.

Critical Rules

  • Keep the merchant private key, client secret, and SFTP password server-side only.
  • Sign the exact bytes you send. Serialize the body once and send that same string.
  • Verify every TNGD response and notification signature with the TNGD public key for the same environment before trusting it.
  • Never mark paid from my.tradePay 9000, paymentReturnUrl, or the web PAY_RETURN redirect alone.
  • A U result is not a failure. Do not fail, refund offline, or re-create the payment; query or wait for the notification.
  • notifyPayment acknowledgement must return S as soon as the message is received; do the business work asynchronously. Non-S triggers retries and duplicates.
  • Settle only when paymentId/acquirementId, your request ID, amount, currency MYR, and partner ID all match the stored pending payment.
  • Partial refunds are allowed; total refunded must not exceed the payment. Use a new refundRequestId per refund and keep it for inquiry.
  • Do not invent the production host, notify URL registration, or notification headers; ask TNGD where docs are silent.
  • The WooCommerce plugin's notification handler does not verify signatures. Do not copy that gap.

Completion Criteria

A TNG eWallet integration is done only when:

  1. Create, query, and refund calls run server-side with correct Client-Id, Request-Time, and RSA256 Signature.
  2. Response signatures are verified with the TNGD public key; failures are rejected and logged.
  3. The notification endpoint verifies the signature, acks with a signed S response, and processes idempotently.
  4. Amount and currency are checked in sen against the stored order before marking paid.
  5. A status inquiry job covers missed notifications and never settles U/PROCESSING.
  6. Refund flow stores refundRequestId, handles U with inquiryRefund, and blocks over-refund.
  7. Tests cover bad signature, duplicate notification, wrong amount, U result, expired order, and success.
  8. Config documents TNG_CLIENT_ID, TNG_PARTNER_ID, TNG_PRIVATE_KEY, TNG_PUBLIC_KEY, API host, notify URL, and sandbox/live separation.

Loophole Review Loop

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

  1. List trust boundaries: mini program or browser, my.tradePay result, return URL, merchant backend, TNGD Open API, notification receiver, key store, database, refund job, SFTP settlement.
  2. Check bypasses: forged notification, unsigned or wrongly signed body, body re-serialized after signing, wrong environment key, sandbox/live mix, wrong amount unit (ringgit vs sen), reused paymentRequestId with different data (REPEAT_REQ_INCONSISTENT), U treated as failure, duplicate notification, notification acked only after processing, expired order paid late, over-refund, refund U refunded offline.
  3. Add fixes: server-side signing, exact-byte signing, response and notification verification, strict ID/amount/currency checks, durable event log, idempotent settlement, inquiry fallback, daily CSV reconciliation.
  4. Re-read the relevant sections of references/tng-ewallet-api.md or references/tng-ewallet-web-acquiring.md.
  5. State remaining uncertainty: production host, notify URL setup for web acquiring, exact notification headers, customerBelongsTo values, key version, rate limits, and anything TNGD only shares in its partner Postman pack.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Setup Tng Ewallet làm được gì?

Set up, build, debug, review, and explain Touch 'n Go eWallet (TNG Digital, TNGD) payment integrations using official TNGD Mini Program Open API docs and the TNGD WooCommerce plugin source, covering /v1/payments/pay cashier and agreement payments, my.tradePay, notifyPayment callbacks, inquiryPayment, refund and inquiryRefund, applyToken/prepare/cancelToken auto debit, RSA256 request and response signatures, Alipay+ style web acquiring (order create/query/refund), sandbox vs production credentials, SFTP settlement files, and partner onboarding. Use when working with Touch 'n Go eWallet, TNG...

Vì sao nên dùng Setup Tng Ewallet trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Setup Tng Ewallet là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Setup Tng Ewallet trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-tng-ewallet. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Setup Tng Ewallet?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Setup Tng Ewallet với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Setup Tng Ewallet với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Setup Tng Ewallet có miễn phí không?

Kỹ năng này được afu-it phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇