---
title: "Pay an invoice (credit, card token, or bank transfer)"
method: POST
path: "/v1/invoices/{invoice_id}/pay"
tags: ["Orders"]
---

# Pay an invoice (credit, card token, or bank transfer)

`POST /v1/invoices/{invoice_id}/pay`

## Request

- Base URL: `https://developers.servera.lt`
- URL: `https://developers.servera.lt/v1/invoices/{invoice_id}/pay`
- Auth: HTTP bearer

Pay one of your unpaid invoices (e.g. the proforma from a just-placed order).

Three payment methods, all settling the invoice through the SAME engine the web
panel uses - a successful payment triggers the exact same provisioning:

- **`credit`** - pay from your account balance, **no browser step**. Returns **402**
  with the amount due + `pay_url` if the balance doesn't cover the full total
  (nothing is deducted in that case).
- **`spt`** - charge a card programmatically with a Stripe **Shared Payment Token**
  (`shared_payment_token`), **no browser step**. Built for agentic checkout: the
  buyer's agent supplies a single-use, amount- and expiry-scoped token and we charge
  that card directly. Declined charges leave the invoice unpaid.
- **`bank_transfer`** - leave the invoice unpaid and return a `pay_url` for a human
  to finish the payment in a browser.

An **`Idempotency-Key`** header is REQUIRED. An already-paid invoice returns success
without charging again (natural idempotency).

On success the response carries the issued **VAT invoice**: `invoice_number` (the fiscal
document number - the proforma is converted in place to a VAT invoice on payment),
`document_type` (`vat`), `converted_from_proforma`, and the amount breakdown
(`net` = be PVM, `vat`, `vat_rate` %, `gross` = su PVM; `total` = `gross`).

There is **no per-payment spend cap by default**; one is applied only if the
`developer_api_max_charge` setting is configured to a positive number.

## Path parameters

- `invoice_id` integer, required

## Headers

- `Idempotency-Key` string, nullable

## Request body

- PayInvoiceBody
  - `method` 'credit' | 'bank_transfer' | 'spt': How to settle the invoice. `credit` = pay from your account balance, no browser step (returns 402 with the amount due if the balance doesn't cover the total). `bank_transfer` = leave the invoice unpaid and return a `pay_url` for a human to complete the payment in a browser. `spt` = charge a card with a Stripe Shared Payment Token supplied in `shared_payment_token` - a fully programmatic card payment for agents, no browser step. See `shared_payment_token` below.
  - `shared_payment_token` string, nullable: A single-use Stripe Shared Payment Token (`spt_...`) - required when `method='spt'`, ignored otherwise. The buyer's agent obtains it from the buyer's payment provider, scoped to a specific amount and expiry; we charge that card directly and, on success, provision the same way as a credit payment. If the token's own limits are exceeded the charge is declined and the invoice stays unpaid.

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/servera/apis/servera-developers-api-2.md) · [All operations](https://skmtc.dev/servera/apis/servera-developers-api-2/llms.txt) · [OpenAPI document](https://skmtc.dev/servera/apis/servera-developers-api-2/revisions/2e744791e77f?raw)
