> For the complete documentation index, see [llms.txt](https://docs.osmosworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.osmosworks.com/api-reference/finance.md).

# Finance and payments

Base path: `/api/v1/finance`

These endpoints manage invoices, payments, and service pricing. They require tenant staff permissions.

## Price breakdown

Prices a service from its charges using a set of answers.

* **Method:** `POST`
* **Path:** `/api/v1/finance/services/{serviceId}/price-breakdown`
* **Permission:** `invoice.read`

### Request body

```json
{
  "answers": {
    "request.express_processing": true,
    "request.number_of_travellers": 2
  },
  "partyCount": 2
}
```

### Response

```json
{
  "status": "Success",
  "message": "Price breakdown retrieved successfully.",
  "data": {
    "currency": "NGN",
    "total": 105000,
    "items": [
      {
        "serviceChargeId": "c9d0e1f2-...",
        "label": "Base application fee",
        "basis": "PER_PARTY",
        "quantity": 2,
        "unitAmount": 50000,
        "itemTotal": 100000
      },
      {
        "serviceChargeId": "d0e1f2a3-...",
        "label": "Express processing",
        "basis": "PER_REQUEST",
        "quantity": 1,
        "unitAmount": 5000,
        "itemTotal": 5000
      }
    ]
  }
}
```

## Invoices

### Create an invoice

* **Method:** `POST`
* **Path:** `/api/v1/finance/invoices`
* **Permission:** `invoice.manage`

#### Service-priced invoice

```json
{
  "serviceId": "c3d4e5f6-...",
  "partyId": "e5f6a7b8-...",
  "description": "Family visa processing",
  "answers": {
    "request.express_processing": true
  },
  "partyCount": 2
}
```

#### Ad-hoc invoice

```json
{
  "amount": 25000,
  "currency": "NGN",
  "description": "Additional consultation fee",
  "partyId": "e5f6a7b8-...",
  "dueAt": "2026-11-01T00:00:00"
}
```

### List invoices

* **Method:** `GET`
* **Path:** `/api/v1/finance/invoices?status=OPEN&page=0&size=20`
* **Permission:** `invoice.read`

### Get an invoice

* **Method:** `GET`
* **Path:** `/api/v1/finance/invoices/{invoiceId}`
* **Permission:** `invoice.read`

### Void an invoice

* **Method:** `POST`
* **Path:** `/api/v1/finance/invoices/{invoiceId}/void`
* **Permission:** `invoice.manage`

Paid invoices cannot be voided.

## Payments

### Start a payment

* **Method:** `POST`
* **Path:** `/api/v1/finance/invoices/{invoiceId}/payments`
* **Permission:** `invoice.manage`

### Request body

```json
{
  "email": "customer@example.com",
  "callbackUrl": "https://acme.example.com/payment/return"
}
```

### Response

```json
{
  "status": "Success",
  "message": "Payment started successfully.",
  "data": {
    "reference": "PAY-000001",
    "status": "PENDING",
    "amount": 105000,
    "currency": "NGN",
    "authorizationUrl": "https://checkout.paystack.com/...",
    "accessCode": "..."
  }
}
```

### List payments

* **Method:** `GET`
* **Path:** `/api/v1/finance/payments?status=PENDING&page=0&size=20`
* **Permission:** `payment.read`

### Get a payment

* **Method:** `GET`
* **Path:** `/api/v1/finance/payments/{reference}`
* **Permission:** `payment.read`

### Reconcile a payment

* **Method:** `POST`
* **Path:** `/api/v1/finance/payments/{reference}/reconcile`
* **Permission:** `payment.reconcile`

## Public payments

Customers can pay an invoice without logging in.

### Start public checkout

* **Method:** `POST`
* **Path:** `/api/v1/public/payments/invoices/{invoiceReference}/checkout`
* **Authentication:** None

### Get public payment

* **Method:** `GET`
* **Path:** `/api/v1/public/payments/{reference}`
* **Authentication:** None

## Paystack webhook

Paystack posts charge success and other events here.

* **Method:** `POST`
* **Path:** `/api/v1/payments/webhook`
* **Authentication:** Paystack signature verification

Configure your Paystack dashboard to send webhooks to this URL.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.osmosworks.com/api-reference/finance.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
