Setup Payrightのロゴ

Setup Payright

コミュニティ
afu-it
setup-payright

公式Payrightドキュメント、Collection APIとBill API、FPX銀行(決済プロバイダー)の選択、ホスト型payment_urlへのリダイレクト、Hash KeyでデコードするJWT(HS256)コールバック、Get Billによるステータス再照会、任意のX-Signature JWTリクエスト署名、auth-tokenヘッダー認証、サンドボックス/本番環境の設定、Payout API、支払いプロバイダー、支払いコールバック、Get Balanceを使って、Payright(マレーシア、payright.my)の決済連携の設定、構築、デバッグ、レビュー、説明を行います。Payright Sdn Bhd、payright.my、FPX B2C/B2Bオンラインバンキング、Payrightの請求、回収、コールバック、入金、仮想プール残高、本番環境への移行準備に関する作業で使用してください。Payright Australia(payright.com.auのBNPL)には使用しないでください。

Add to TypingMind

概要

公開者afu-it
リポジトリmalaysia-payment-gateway
スキル名setup-payright
スター
74
フォーク
11
同梱ファイル
4
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 4個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    afu-itがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Setup Payright」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-payright
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをその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-payright .claude/skills/setup-payright
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSetup Payrightを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSetup Payrightを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Setup Payrightは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Payright Payment Gateway

Use this skill for Payright (Payright Sdn Bhd, Kuala Lumpur) payment gateway integration work.

Source

Read references/payright-api.md before giving factual API guidance or writing integration code. It contains the endpoint catalogue, base URLs, auth header, Collection and Bill request/response fields, the JWT callback format and decode rules, Get Bill requery, request signing (X-Signature), payout and balance APIs, error codes, payment provider IDs, and documented gaps.

Read references/account-setup.md when the user asks how to register, where the Auth Token and Hash Key live, sandbox vs live, env var names, JWT verification toggle, payment methods, settlement, or pricing.

Read references/source-map.md when choosing which official Payright page applies, or to see which areas are undocumented and which legacy (2022) plugin sources must not be copied.

Core Workflow

  1. Identify environment: sandbox (https://api.payright-sandbox.my/api/v1) or production (https://api.payright.my/api/v1).
  2. Identify surface: Bill API (FPX checkout), Payout API (disbursement), or no-code (Payment Forms, Bills in the portal, plugins).
  3. Confirm dashboard setup: Auth Token, Hash Key, JWT Verification on/off, a Collection (collection_uuid), and active payment services.
  4. Create a local pending payment with your own unique invoice_ref before calling Payright.
  5. Fetch providers with POST /merchant/list-payment-provider and let the payer choose a bank; provider_id is required on the bill.
  6. Create the bill server-side with POST /merchant/bills; store invoice_no, invoice_ref, amount; redirect the payer to payment_url.
  7. Treat redirect_url as browser UX only; nothing in the docs makes it a trusted payment result.
  8. On callback, read the JSON body {"data": "<JWT>", "response_code": ...} and verify the JWT with HS256 and the Hash Key. Reject on any verification failure.
  9. Settle idempotently after invoice_ref, amount, and invoice_status == "SUCCESS" match; then confirm with GET /merchant/bills/{invoice_ref}.
  10. Use Get Bill as the fallback for missing callbacks; the docs only promise callbacks after successful transactions.

Core Facts

  • Production API base: https://api.payright.my/api/v1. Sandbox: https://api.payright-sandbox.my/api/v1.
  • Auth header: auth-token: <AUTH_TOKEN> (docs prose says "Authorization header with value auth-token {token}", but every example and the official Postman collection send a header named auth-token).
  • Auth Token: Accounts > API Keys > View API Keys > Auth Token. Hash Key: Account > API Keys > View API Key > Hash Key.
  • Create Bill: POST /merchant/bills, required collection_uuid, amount (MYR, decimal 10,2), provider_id, callback_url, redirect_url, full_name, email, phone_number; invoice_ref is in the example (your reference, error 425 "Invoice already exists" on reuse).
  • Create Bill returns invoice_no (e.g. Py...rgt), invoice_ref, payment_url.
  • Get Bill: GET /merchant/bills/{invoice_no} or GET /merchant/bills/{invoice_ref}; returns transaction_details.status (e.g. PENDING) and fpx_invoice_no.
  • Callback body is JSON with data (HS256 JWT signed with the Hash Key) and response_code (sample 2100). Decoded fields include invoice_no, invoice_ref, invoice_status (SUCCESS), amount (string "240.00").
  • The callback invoice_no is the FPX invoice number (FPX...), which matches Get Bill fpx_invoice_no, not the Py... bill invoice_no. Match on invoice_ref.
  • Request signing is optional: when JWT Verification is enabled (Account > API Keys > Edit), send x-signature, an HS256 JWT of {auth-token, http_method, url_path, iat, exp} signed with the Hash Key.
  • Amounts are ringgit with two decimals, not sen. MYR only.
  • Response envelope: status (ok/fail), code, data, uuid, message, error. Business errors can arrive with HTTP 200; always check status and code.
  • Payout: POST /merchant/payout, GET /merchant/payout/{invoice_no|external_invoice_ref}, providers via POST /merchant/list-payout-providers, balance via GET /merchant/balance.
  • Duplicate payout guard: error 10149 if amount, account_no and recipient_reference repeat within 3 hours.
  • Sandbox failed bills do not count toward dashboard or settlement totals.

Critical Rules

  • Keep Auth Token and Hash Key server-side only. Never ship them to the browser or a mobile app.
  • Never mark paid from redirect_url or any browser query string.
  • Verify the callback JWT signature (HS256, Hash Key) and pin the algorithm to HS256; never accept alg: none or decode without verifying.
  • Match on invoice_ref (and amount), not on the callback invoice_no, because it is the FPX number.
  • Compare amounts as decimal strings or integer sen; the callback sends "240.00" as a string.
  • Make callback handling idempotent; a late or repeated callback must not double-fulfil.
  • After a verified callback, requery Get Bill when possible and settle from server-side state.
  • Generate a unique invoice_ref per attempt; reusing one returns 425.
  • Do not use the 2022 GitHub plugins (payright.my/api, Bearer auth, HMAC signature field) as a reference for the current API; they target a retired API.
  • Do not confuse Payright Malaysia with Payright Australia (payright-engineering GitHub, BNPL).
  • Verify current payment method activation, settlement schedule and pricing in the portal before claiming production certainty.

Completion Criteria

A Payright integration is done only when:

  1. Bill creation runs server-side with the auth-token header against the correct environment base URL.
  2. A local pending payment with a unique invoice_ref exists before the bill is created, and invoice_no is stored after.
  3. provider_id comes from the live list-payment-provider response for that environment, not a hardcoded table.
  4. The callback handler verifies the data JWT with HS256 and the Hash Key, then matches invoice_ref, amount, and invoice_status.
  5. Settlement is idempotent and confirmed with Get Bill; a scheduled requery covers missing callbacks.
  6. If JWT Verification is enabled in the portal, every request carries a fresh x-signature.
  7. Tests cover a forged or tampered JWT, wrong Hash Key, duplicate callback, wrong amount, unknown invoice_ref, non-SUCCESS status, and a successful payment.
  8. Deployment docs list PAYRIGHT_AUTH_TOKEN, PAYRIGHT_HASH_KEY, PAYRIGHT_COLLECTION_UUID, PAYRIGHT_BASE_URL, callback URL, redirect URL, and sandbox/live separation.

Loophole Review Loop

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

  1. List trust boundaries: browser redirect, bank selection UI, backend bill creator, Payright API, callback receiver, JWT verifier, database, fulfilment job, payout job, portal settings.
  2. Check bypasses: fake redirect success, forged callback JWT, unverified decode, alg confusion, wrong Hash Key, sandbox/live mix, matching on FPX invoice_no instead of invoice_ref, wrong amount, reused invoice_ref, stale Get Bill, duplicate callback, missing callback for failed payments, HTTP 200 with status: fail, expired x-signature, duplicate payout within 3 hours, insufficient payout pool.
  3. Add fixes: server-side bill creation, local pending payment first, HS256-pinned JWT verification, strict invoice_ref/amount/status checks, durable callback log, idempotency keys, separate environment config, Get Bill requery job, short-lived x-signature.
  4. Re-read references/payright-api.md sections relevant to any gap.
  5. State remaining uncertainty where the docs are silent: refunds, status enum beyond PENDING/SUCCESS, callback retries, redirect parameters, rate limits, IP allowlists, and callback exp/iat.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Setup Payright」では何ができますか?

公式Payrightドキュメント、Collection APIとBill API、FPX銀行(決済プロバイダー)の選択、ホスト型payment_urlへのリダイレクト、Hash KeyでデコードするJWT(HS256)コールバック、Get Billによるステータス再照会、任意のX-Signature JWTリクエスト署名、auth-tokenヘッダー認証、サンドボックス/本番環境の設定、Payout API、支払いプロバイダー、支払いコールバック、Get Balanceを使って、Payright(マレーシア、payright.my)の決済連携の設定、構築、デバッグ、レビュー、説明を行います。Payright Sdn Bhd、payright.my、FPX B2C/B2Bオンラインバンキング、Payrightの請求、回収、コールバック、入金、仮想プール残高、本番環境への移行準備に関する作業で使用してください。Payright Australia(payright.com.auのBNPL)には使用しないでください。

TypingMindでSetup Payrightを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Setup Payrightはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSetup Payrightをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/afu-it/malaysia-payment-gateway/tree/main/setup-payrightを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Setup Payrightを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Setup Payrightで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSetup Payrightを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Setup Payright」は無料ですか?

afu-itがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇