Install and log in
Use the Pay.com API from your terminal.
pay operates in the sandbox environment only and rejects live API keys.
Install
Install pay with Homebrew or Scoop, or run it in Docker.
brew install pay-com/tap/payscoop bucket add pay-com https://github.com/pay-com/scoop-bucket
scoop install paydocker run --rm -e PAY_COM_API_KEY ghcr.io/pay-com/pay charges listCheck that it works:
pay versionLog in
Make a sandbox key under Developers → API keys, then run:
pay loginpay asks for the key without showing it, checks it, and keeps it in your
operating system's keychain. There's no flag for the key itself, so it stays
out of your shell's history. To remove it, run pay logout.
A key that works but can't read webhook endpoints is kept, with a warning. A
key the API refuses isn't kept. When the key can't be checked, for example
without a connection, --no-verify keeps it anyway.
In a script, pass the key on standard input:
printf '%s' "$PAY_COM_API_KEY" | pay login --api-key-stdinPermissions
Give the key the permissions
of what you'll call with it. For pay listen,
that's Write on Webhook endpoints, and Read on the resources whose events
you forward.
Use several keys
A profile keeps a key and a workspace of its own:
pay login --profile shop --merchant-id "$MERCHANT_ID"
pay charges list --profile shopUse --merchant-id with multi-workspace API keys. Without
--profile, commands use the default profile.
Use it in CI
Commands use PAY_COM_API_KEY when it's set, ahead of any stored key, and
store nothing:
pay charges list --limit 3pay login and pay listen keep a secret. Where there's no keychain, set
PAY_COM_CLI_KEYRING=file to keep it in a file only your user can read.