Logo de Setup Commercepay

Setup Commercepay

Comunidade
afu-it
setup-commercepay

Set up, build, debug, review, and explain CommercePay (Commerce DotAsia Payments) payment integrations using official CommercePay docs, TokenAuth bearer tokens, Abp-TenantId header, cap-signature HMAC-SHA256 request signing, Direct Integration RequestPayment, Hosted Session Checkout InitialSession, signed host-to-host callbacks, Query Payment, refunds, saved payments and tokenisation, recurring payments, pre-auth ProcessPayment, payouts via bank account or DuitNow Proxy, payout wallets, channel and provider channel codes, and staging/production setup. Use when working with CommercePay Malaysia, FPX B2C/B2B, DuitNow Online Banking, DuitNow QR, cards, Apple Pay, Google Pay, TNG eWallet, GrabPay, ShopeePay, Boost, Alipay, Atome, callback verification, settlement, or production readiness.

Visão geral

Publicado porafu-it
Repositóriomalaysia-payment-gateway
Nome da habilidadesetup-commercepay
Estrelas
74
Forks
11
Arquivos incluídos
5
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    Habilidades de IA são Markdown simples, não código específico de um provedor, por isso funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • 5 arquivos incluídos

    Scripts, modelos de documentos e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente leitura e nunca são executados.

  • Código aberto

    Publicada por afu-it no GitHub. Leia o conteúdo-fonte antes de instalar.

Instalação

Instale a habilidade de IA Setup Commercepay no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL da pasta da habilidade exibida abaixo e confirme.
    https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-commercepay
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Nova habilidade → Via URL GitHub, depois cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

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-commercepay .claude/skills/setup-commercepay
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Setup Commercepay em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Setup Commercepay automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Setup Commercepay não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

CommercePay Payment Gateway

Use this skill for CommercePay (payments.commerce.asia) payment gateway integration work.

Source

Read references/commercepay-api.md before giving factual API guidance or writing integration code. It holds environments, auth, headers, the exact cap-signature algorithm with verified test vectors, the endpoint catalogue, request/response field tables, callback verification, status enums, refunds, saved payments, recurring, payouts, wallets, and error codes.

Read references/commercepay-codes.md when you need channelId values, FPX/DuitNow providerChannelId bank codes, payout bank codes, DuitNow Proxy codes, or staging payout test accounts.

Read references/account-setup.md when the user asks how to register, which credentials are issued, back-office location, staging vs production, env var names, recurring/payout enablement, plugins, settlement, or pricing.

Read references/source-map.md to pick the right official page for a topic.

Core Workflow

  1. Identify environment: staging (https://staging-payments.commerce.asia/) or production (https://payments.commerce.asia/).
  2. Identify surface: Direct Integration (merchant renders channels), Hosted Session Checkout (CommercePay page), recurring, saved payment, pre-auth, refund, or payout.
  3. Confirm the four credentials for that environment: Merchant Id, Username, Password, Secret Key.
  4. Call POST /api/TokenAuth/Authenticate (header Abp-TenantId, no signature) and cache the accessToken for up to 24 hours.
  5. Create a local pending payment with your unique referenceCode and expected amount in sen before calling CommercePay.
  6. Sign every other request: lowercase(full URL + recursively key-sorted, minified, null-free camelCase JSON) then HMAC-SHA256 hex with the Secret Key into cap-signature.
  7. Call RequestPayment (Direct) or InitialSession (Hosted) server-side with a callbackUrl; store transactionNumber or sessionNumber.
  8. Send the browser to result.redirectUrl (or run clientScript when redirectionType is 2).
  9. Treat returnUrl as UX only. Verify the callback cap-signature (computed with YOUR callbackUrl as the prefix), answer HTTP 200, then confirm with GET Query.
  10. Settle idempotently when status is 1 (Success) and referenceCode, transactionNumber, amount, currency and environment match.

Core Facts

  • Base URLs: staging https://staging-payments.commerce.asia/, production https://payments.commerce.asia/.
  • Every API call except Authenticate needs Content-Type: application/json, Authorization: Bearer <accessToken>, Abp-TenantId: <MERCHANT_ID>, cap-signature.
  • Token: POST /api/TokenAuth/Authenticate body userNameOrEmailAddress, password; returns accessToken, expireInSeconds 86400.
  • Payment: POST /api/services/app/PaymentGateway/RequestPayment. Hosted session: POST /api/services/app/PaymentGateway/InitialSession.
  • Status: GET /api/services/app/PaymentGateway/Query?TransactionNumber=...&Timestamp=... (or SessionNumber).
  • Refund: POST .../PaymentGateway/RefundPayment; refund status: GET .../PaymentGateway/QueryRefund.
  • Amounts are integers in minor units: 1000 = MYR 10.00.
  • timestamp is Unix epoch milliseconds (new Date().getTime()), required on signed bodies.
  • Responses use an ABP envelope: { result, targetUrl, success, error: { code, message }, unAuthorizedRequest, __abp }.
  • Callback is a POST to callbackUrl with amount, channelId, currencyCode, referenceCode, status, transactionNumber, providerTransactionNumber (+ paymentSessionNumber for sessions), signed in cap-signature.
  • Payment status 0 Pending, 1 Success, 2 Failed, 3 Cancelled, 8 UserCancelled, 9 Authorized, 10 TransactionExpired, 11 Refunded (full table in api reference).
  • No callbackUrl means no callback; you must poll Query Payment.
  • Payout uses the same RequestPayment endpoint with payout channelId (staging 15, production 9) and a funded payout wallet.
  • Channel IDs differ between staging and production (for example TNG is 10 in staging, 7 in production).
  • Signature Validator Tool (staging back office): https://staging-backoffice-payments.commerce.asia/app/paymentgateway/signaturevalidator.

Critical Rules

  • Keep Password, Secret Key and access token server-side only.
  • Do not mark paid from returnUrl, browser query strings, or frontend state.
  • Verify callback cap-signature with constant-time comparison before trusting any field.
  • Sign with raw UTF-8 (no \uXXXX escapes), only JSON-required escaping (+ < > & ' stay literal), Unicode-aware lowercase.
  • Omit null fields at every nesting level before signing; keep empty strings.
  • For GET, sign the URL without the query string plus the query params as sorted JSON, numbers unquoted.
  • Use the Secret Key, channel IDs, and callback URL of the same environment.
  • Pass providerChannelId only when the channel has isProviderHostChannel: true; otherwise omit it.
  • Keep referenceCode unique per payment attempt (max 50) and the callback handler idempotent.
  • Refunds only on Success transactions; omit amount for full refund; reason is required; cross-border refunds are not supported.
  • Recurring (Credit Card, TNG only) and payouts require Business Development approval first.

Completion Criteria

A CommercePay integration is done only when:

  1. Token is fetched server-side, cached, and refreshed on expiry or auth failure.
  2. All signed requests pass in staging (use the Signature Validator Tool when debugging).
  3. RequestPayment or InitialSession runs server-side with callbackUrl, and the returned id is stored before redirect.
  4. Callback handler verifies cap-signature, returns HTTP 200, and requeries Query before settling.
  5. Settlement checks referenceCode, transactionNumber/paymentSessionNumber, amount, currency, status 1, and environment.
  6. Duplicate callbacks, missing callbacks (Query polling fallback), and expired/failed statuses are handled idempotently.
  7. Tests cover invalid signature, null-field and non-ASCII signing, duplicate callback, wrong amount/reference, and status 0, 2, 8, 10.
  8. Deployment docs list COMMERCEPAY_MERCHANT_ID, COMMERCEPAY_USERNAME, COMMERCEPAY_PASSWORD, COMMERCEPAY_SECRET_KEY, COMMERCEPAY_BASE_URL, callback and return URLs per environment.

Loophole Review Loop

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

  1. List trust boundaries: browser return, hosted session page, provider page, backend payment creator, token cache, CommercePay API, callback receiver, database, fulfilment, refund job, payout job, wallet balance, back office.
  2. Check bypasses: forged return URL, forged callback, signature over the wrong URL (request path instead of your callbackUrl), escaped Unicode, nulls left in, unsorted nested keys, staging/production key or channel mix, expired token, reused referenceCode, wrong amount unit, session with several attempts, refund double-submit, payout to unregistered DuitNow proxy.
  3. Add fixes: server-side creation, local pending record first, canonical signing helper with the published test vectors, constant-time compare, strict field matching, Query requery, durable event log, idempotency keys, per-environment config.
  4. Re-read references/commercepay-api.md sections relevant to any gap.
  5. State remaining uncertainty: callback retry schedule, IP allowlist, timestamp tolerance, return URL parameters, and rate limits are not documented in official docs (checked 2026-10-21).

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Setup Commercepay faz?

Set up, build, debug, review, and explain CommercePay (Commerce DotAsia Payments) payment integrations using official CommercePay docs, TokenAuth bearer tokens, Abp-TenantId header, cap-signature HMAC-SHA256 request signing, Direct Integration RequestPayment, Hosted Session Checkout InitialSession, signed host-to-host callbacks, Query Payment, refunds, saved payments and tokenisation, recurring payments, pre-auth ProcessPayment, payouts via bank account or DuitNow Proxy, payout wallets, channel and provider channel codes, and staging/production setup. Use when working with CommercePay Malay...

Por que usar Setup Commercepay no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. Setup Commercepay é escrito em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. O TypingMind usa suas próprias chaves de API, então o pagamento é feito diretamente aos provedores, em vez de uma assinatura por licença de usuário, e suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Setup Commercepay no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-commercepay. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Setup Commercepay?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Setup Commercepay?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Setup Commercepay com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Setup Commercepay é gratuita?

A habilidade é publicada no GitHub por afu-it. Consulte os termos de licenciamento no repositório. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, modelos de documento ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas para chamar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA fornece conhecimento e um processo ao modelo: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇