← 返回
未分类 Key

Mayar

Interact with the Mayar payment platform (invoices, products, payments, customers, transactions, webhooks, QR codes) from any AI agent or shell. Zero depende...
在任意 AI 代理或 shell 中与 Mayar 支付平台交互(发票、产品、支付、客户、交易、webhook、二维码),零依赖。
mayar
未分类 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 1
Stars
📥 293
下载
💾 0
安装
1
版本
#latest

概述

Mayar CLI — Agent Skill

This document describes how AI agents (Claude Code, OpenClaw, and others)

should install, authenticate, and use the mayar CLI tool.

Quick start for agents

# Always use the latest version — no install step required
npx -y mayar@latest whoami

Authentication flow

Step 1 — detect active user

Run whoami to check if a valid API key is already configured:

npx -y mayar@latest whoami --json

Successful output contains "valid": true and the merchant's name, email,

and accountId. If the key is valid, proceed directly to the requested task.

Step 2 — handle missing or invalid key

If whoami exits non-zero or returns "valid": false, the agent MUST stop

and ask the user for their API key using one of the following options:

> Option A — environment variable (recommended for non-interactive agents):

>

> Ask the user to set:

> ```bash

> export MAYAR_API_KEY=

> ```

> Then re-run the original command.

> Option B — one-time flag (single command):

>

> Ask the user to provide the key and pass it as:

> ```bash

> npx -y mayar@latest --api-key whoami

> ```

> Option C — interactive setup (terminal agents only):

>

> If the agent has access to an interactive TTY:

> ```bash

> npx -y mayar@latest init

> ```

Agents must NEVER fabricate or guess an API key. Always stop and ask the user.

Get a key at: https://web.mayar.id → Integration → API Key

Usage reference

All commands use the pattern:

npx -y mayar@latest <command> [subcommand] [args] [flags]

Account

npx -y mayar@latest whoami              # verify key + show merchant identity
npx -y mayar@latest balance             # account balance

Invoices

npx -y mayar@latest invoice list [--page N --pageSize N]
npx -y mayar@latest invoice get <id>
npx -y mayar@latest invoice close <id>
npx -y mayar@latest invoice reopen <id>
npx -y mayar@latest invoice create --data '<json>'
npx -y mayar@latest invoice create --data @file.json

Products

npx -y mayar@latest product list [--page N --pageSize N]
npx -y mayar@latest product search <keyword>
npx -y mayar@latest product type <ebook|course|membership|saas|event|webinar>
npx -y mayar@latest product get <id>
npx -y mayar@latest product close <id>
npx -y mayar@latest product reopen <id>

Payments

npx -y mayar@latest payment list
npx -y mayar@latest payment get <id>
npx -y mayar@latest payment close <id>
npx -y mayar@latest payment reopen <id>
npx -y mayar@latest payment create --data '<json>'

Customers

npx -y mayar@latest customer list [--page N --pageSize N]
npx -y mayar@latest customer create --data '<json>'

Transactions

npx -y mayar@latest tx list   [--page N --pageSize N]   # paid
npx -y mayar@latest tx unpaid [--page N --pageSize N]   # unpaid

Dynamic QR

npx -y mayar@latest qrcode <amount_in_idr>

Webhooks

npx -y mayar@latest webhook register <url>
npx -y mayar@latest webhook test <url>
npx -y mayar@latest webhook history [--page N --pageSize N]

Global flags

FlagDescription
----------------------------------------------------------------------
--jsonOutput raw JSON (machine-readable, pipe to jq)
--api-key Override saved key for this invocation
--page NPagination page (default 1)
--pageSize NItems per page (default 10)
-v, --versionPrint version
-h, --helpPrint help

JSON output

Always use --json when the agent needs to parse the response:

npx -y mayar@latest invoice list --json | jq '.data[] | {id, status}'
npx -y mayar@latest whoami --json | jq '{valid, name: .decoded.name}'

Error handling

  • Non-zero exit code = command failed
  • "valid": false in whoami --json = invalid or expired API key
  • HTTP errors print API on stderr

Agent decision tree

START
  └─ run: npx -y mayar@latest whoami --json
        ├─ exit 0 + valid=true  →  proceed with task
        └─ exit non-zero or valid=false
              └─ ask user:
                    "Please provide your Mayar API key.
                     You can either:
                     (A) set the MAYAR_API_KEY environment variable, or
                     (B) run: npx -y mayar@latest init
                     Get your key from https://web.mayar.id → Integration → API Key"

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-08 03:01 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,099 📥 825,407
ai-agent

Agent Browser

rez0
用于 AI 代理的浏览器自动化 CLI。当用户需要与网站交互(包括浏览页面、填写表单、点击按钮、截图等)时使用。
★ 834 📥 305,891
ai-agent

Find Skills

guipi888
场景驱动+关键词双模式技能发现工具。当用户用自然语言描述场景/需求(如"我想做一个海报""帮我分析股票"),或明确说"安装技能/find skills/找个skill"时,自动从官方内置、本地已安装、SkillHub、虾评、GitHub、C
★ 1,460 📥 515,794