Skip to main content
Command reference

codespar charges

Charges: issue one, read it, list them, withdraw one

2 min read
View MarkdownEdit on GitHub

Charges: issue one, read it, list them, withdraw one

5 commands in @codespar/cli 0.16.0.

Each one prints what its operation answered. What a command prints has the rule, and Configuration has the exit codes and the shape of a failure.

codespar charges list

List charges

codespar charges list
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

GET /v1/charges · parameters, responses and refusals

codespar charges create

Issue a charge

codespar charges create --input-file body.json
body.json
{
  "amount": 1000,
  "currency": "BRL",
  "method": "string",
  "consumer_id": "csm_0000000000000000",
  "description": "string",
  "buyer": {},
  "due_date": "string",
  "idempotency_key": "string",
  "country": "string",
  "metadata": {}
}
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds
-i, --input <json>Request body as a JSON string
-f, --input-file <path>Request body from a JSON file

POST /v1/charges · parameters, responses and refusals

codespar charges get

Read a charge

codespar charges get charge_0000000000000000
argumentwhat it is
<chargeId>String.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

GET /v1/charges/{chargeId} · parameters, responses and refusals

codespar charges cancel

Withdraw a charge

codespar charges cancel charge_0000000000000000
argumentwhat it is
<chargeId>String.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

POST /v1/charges/{chargeId}/cancel · parameters, responses and refusals

codespar charges sandbox-pay

Pay a charge in the sandbox (alias path)

Deprecated route. The served document marks this operation as dead. The command still answers today and will go; the HTTP reference below names what took its place.

codespar charges sandbox-pay charge_0000000000000000 --input '{"amount_minor":1000}'
argumentwhat it is
<chargeId>String.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds
-i, --input <json>Request body as a JSON string
-f, --input-file <path>Request body from a JSON file

POST /v1/charges/{chargeId}/sandbox/pay · parameters, responses and refusals

codespar charges | CodeSpar