Payments API

Clientary provides programmatic access to payments. You can programmatically apply a payment to an invoice or remove an existing payment.

You can also retrieve payments on an invoice via the Invoice API.

Get All Payments

GET /api/v2/payments
{
  "page_size": 30,
  "page_count": 1,
  "total_count": 30,
  "payments": [
    {
      "id": 980190972,
      "amount": 20.0,
      "note": "Received check #123",
      "invoice_id": 20231421,
      "received_on": "2017-07-22",
      "transaction_fee_amount": 0.0,
      "transaction_id": "ch_BK0cuioz1Vq9vm"
    },
    ...
  ]
}

Note that the transaction_id value is only populated when the payment was made through an integrated payment gateway and will correspond to the gateway used for the particular payment in question.

GET /api/v2/payments?page=2

On a bulk GET Clientary will return 30 results at once. To paginate through more results, you can use the page parameter.

GET /api/v2/payments?sort=created_at

By default, the end point will return payments sorted by reverse chronological order of the received_on attribute. Use created_at to sort by actual record create time instead.

Post A New Invoice Payment

POST /api/v2/invoices/:invoice_id/payments
{
  "payment": {
    "amount": 500,
    "note": "Paid by Check"
  }
}

Required Fields: amount (HTTP 422 on failure)

Post A New Invoice Payment and Auto-Charge Client Payment Profile

POST /api/v2/invoices/:invoice_id/payments
{
  "payment": {
    "payment_profile_id": 123
  }
}

Required Fields: payment_profile_id (HTTP 422 on failure)
Note that if a payment_profile_id is used, amount and note are ignored. This implies that the entire outstanding amount of the invoice will be charged.

Delete A Payment

DELETE /api/v2/invoices/:invoice_id/payments/:id

Deletion of payment requires presence of invoice_id.

Deletions are permanent and not reversible.