{"skill":{"slug":"mayar","displayName":"Mayar","summary":"Interact with the Mayar payment platform (invoices, products, payments, customers, transactions, webhooks, QR codes) from any AI agent or shell. Zero depende...","description":"---\nname: mayar\ndisplay_name: Mayar CLI\nversion: \"0.1.8\"\ndescription: >\n  Interact with the Mayar payment platform (invoices, products, payments,\n  customers, transactions, webhooks, QR codes) from any AI agent or shell.\n  Zero dependencies — Node.js 18+ only.\nauthor: Mayar bot\nlicense: MIT\nhomepage: https://github.com/mayarid/mayar-cli\nrepository: https://github.com/mayarid/mayar-cli.git\ntags:\n  - payments\n  - invoices\n  - mayar\n  - indonesia\n  - cli\n  - tool\nruntime: node>=18\ninstall_command: npx -y mayar@latest\ninvoke_prefix: npx -y mayar@latest\nenv:\n  MAYAR_API_KEY:\n    description: Mayar API key. Obtain from web.mayar.id → Integration → API Key.\n    required: true\n    secret: true\n  MAYAR_API_URL:\n    description: Override API base URL. Defaults to https://api.mayar.id.\n    required: false\n    default: https://api.mayar.id\nauth:\n  type: bearer\n  resolution_order:\n    - flag: --api-key\n    - env: MAYAR_API_KEY\n    - file: ~/.config/mayar/config.json\ncapabilities:\n  - invoices\n  - products\n  - payments\n  - customers\n  - transactions\n  - webhooks\n  - qrcode\n  - balance\n  - whoami\n---\n\n# Mayar CLI — Agent Skill\n\nThis document describes how AI agents (Claude Code, OpenClaw, and others)\nshould install, authenticate, and use the `mayar` CLI tool.\n\n## Quick start for agents\n\n```bash\n# Always use the latest version — no install step required\nnpx -y mayar@latest whoami\n```\n\n## Authentication flow\n\n**Step 1 — detect active user**\n\nRun `whoami` to check if a valid API key is already configured:\n\n```bash\nnpx -y mayar@latest whoami --json\n```\n\nSuccessful output contains `\"valid\": true` and the merchant's `name`, `email`,\nand `accountId`. If the key is valid, proceed directly to the requested task.\n\n**Step 2 — handle missing or invalid key**\n\nIf `whoami` exits non-zero or returns `\"valid\": false`, the agent MUST stop\nand ask the user for their API key using one of the following options:\n\n> **Option A — environment variable (recommended for non-interactive agents):**\n>\n> Ask the user to set:\n> ```bash\n> export MAYAR_API_KEY=<their_key>\n> ```\n> Then re-run the original command.\n\n> **Option B — one-time flag (single command):**\n>\n> Ask the user to provide the key and pass it as:\n> ```bash\n> npx -y mayar@latest --api-key <their_key> whoami\n> ```\n\n> **Option C — interactive setup (terminal agents only):**\n>\n> If the agent has access to an interactive TTY:\n> ```bash\n> npx -y mayar@latest init\n> ```\n\nAgents must NEVER fabricate or guess an API key. Always stop and ask the user.\n\nGet a key at: **https://web.mayar.id → Integration → API Key**\n\n## Usage reference\n\nAll commands use the pattern:\n\n```\nnpx -y mayar@latest <command> [subcommand] [args] [flags]\n```\n\n### Account\n\n```bash\nnpx -y mayar@latest whoami              # verify key + show merchant identity\nnpx -y mayar@latest balance             # account balance\n```\n\n### Invoices\n\n```bash\nnpx -y mayar@latest invoice list [--page N --pageSize N]\nnpx -y mayar@latest invoice get <id>\nnpx -y mayar@latest invoice close <id>\nnpx -y mayar@latest invoice reopen <id>\nnpx -y mayar@latest invoice create --data '<json>'\nnpx -y mayar@latest invoice create --data @file.json\n```\n\n### Products\n\n```bash\nnpx -y mayar@latest product list [--page N --pageSize N]\nnpx -y mayar@latest product search <keyword>\nnpx -y mayar@latest product type <ebook|course|membership|saas|event|webinar>\nnpx -y mayar@latest product get <id>\nnpx -y mayar@latest product close <id>\nnpx -y mayar@latest product reopen <id>\n```\n\n### Payments\n\n```bash\nnpx -y mayar@latest payment list\nnpx -y mayar@latest payment get <id>\nnpx -y mayar@latest payment close <id>\nnpx -y mayar@latest payment reopen <id>\nnpx -y mayar@latest payment create --data '<json>'\n```\n\n### Customers\n\n```bash\nnpx -y mayar@latest customer list [--page N --pageSize N]\nnpx -y mayar@latest customer create --data '<json>'\n```\n\n### Transactions\n\n```bash\nnpx -y mayar@latest tx list   [--page N --pageSize N]   # paid\nnpx -y mayar@latest tx unpaid [--page N --pageSize N]   # unpaid\n```\n\n### Dynamic QR\n\n```bash\nnpx -y mayar@latest qrcode <amount_in_idr>\n```\n\n### Webhooks\n\n```bash\nnpx -y mayar@latest webhook register <url>\nnpx -y mayar@latest webhook test <url>\nnpx -y mayar@latest webhook history [--page N --pageSize N]\n```\n\n## Global flags\n\n| Flag              | Description                                           |\n| ----------------- | ----------------------------------------------------- |\n| `--json`          | Output raw JSON (machine-readable, pipe to `jq`)      |\n| `--api-key <key>` | Override saved key for this invocation                |\n| `--page N`        | Pagination page (default 1)                           |\n| `--pageSize N`    | Items per page (default 10)                           |\n| `-v, --version`   | Print version                                         |\n| `-h, --help`      | Print help                                            |\n\n## JSON output\n\nAlways use `--json` when the agent needs to parse the response:\n\n```bash\nnpx -y mayar@latest invoice list --json | jq '.data[] | {id, status}'\nnpx -y mayar@latest whoami --json | jq '{valid, name: .decoded.name}'\n```\n\n## Error handling\n\n- Non-zero exit code = command failed\n- `\"valid\": false` in `whoami --json` = invalid or expired API key\n- HTTP errors print `API <status> — <message>` on stderr\n\n## Agent decision tree\n\n```\nSTART\n  └─ run: npx -y mayar@latest whoami --json\n        ├─ exit 0 + valid=true  →  proceed with task\n        └─ exit non-zero or valid=false\n              └─ ask user:\n                    \"Please provide your Mayar API key.\n                     You can either:\n                     (A) set the MAYAR_API_KEY environment variable, or\n                     (B) run: npx -y mayar@latest init\n                     Get your key from https://web.mayar.id → Integration → API Key\"\n```\n","topics":["Mayar","CLI","Invoices","Payments","Indonesia"],"tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":353,"installsAllTime":13,"installsCurrent":0,"stars":1,"versions":1},"createdAt":1777703950283,"updatedAt":1778492826217},"latestVersion":{"version":"1.0.0","createdAt":1777703950283,"changelog":"- Initial release of the Mayar CLI skill for AI agents and shells.\n- Interact with the Mayar payment platform to manage invoices, products, payments, customers, transactions, webhooks, and QR codes.\n- Supports authentication via API key (env, flag, or config file) and provides a structured agent decision flow for handling keys.\n- Offers concise, script-friendly CLI commands with JSON output for easy integration.\n- Requires Node.js 18+ and has zero external dependencies.","license":"MIT-0"},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"mayar","userId":"s170d3yh6qapqenwkjhxs2c5cs85z982","displayName":"Mayar","image":"https://mayar-web.r2.mayar.id/mayar-icon-1024.png"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780090731929}}