Skip to content
Console
On this page

Record payment on an invoice

A seller operator records an externally verified full invoice payment.

A seller operator records an externally verified full invoice payment. The platform-only scope cannot be granted by customer owners/admins. The invoice name identifies the customer, not the seller. References are immutable and idempotent per org and method; conflicting reuse is refused.

  • Path POST https://api.sylphx.com/v1/orgs/acme/invoices/invoice:recordPayment
  • Scope billing:payments:record
  • Effect write — a successful call changes state.
  • Collection invoices

Request

FieldTypeWhat it is
namestringThe invoice to settle in full. Required.
payment_methodstringcard or invoice debits cash; internal_settlement debits a dedicated noncash journal account, never cash or promotional/customer credit. Required.
settlement_referencestringBank/provider/journal reference, 1..200 bytes, unique per org and method. Required.
amountMoneyPositive exact full outstanding balance in USD integer minor units. Required.

Money

FieldTypeWhat it is
currency_codestringISO 4217 currency, for example USD. Required.
units_minorint64The amount in the currency's minor unit (cents for USD). Required.

Response

FieldTypeWhat it is
namestringorgs/{org}/invoices/{invoice}.
uidstringinv_<cell><ulid>. Output only.
metaResourceMetaResource metadata. Output only.
numberstringThe human-readable invoice number, unique per org. Output only.
stateInvoiceStateThe invoice's lifecycle state. Output only. One of draft, open, paid, void, uncollectible, credited.
currency_codestringISO 4217 currency of every amount. Output only.
period_start_timetimestampThe start of the billed period. Output only.
period_end_timetimestampThe end of the billed period. Output only.
linesInvoiceLine[]The lines, grouped by service. Output only.
subtotalMoneyThe sum of the rounded lines before tax. Output only.
taxMoneyTax. Output only.
totalMoneySubtotal plus tax. Output only.
amount_dueMoneyWhat is still owed. Output only.
amount_paidMoneyWhat has been paid, confirmed by provider readback or authorized settlement. Output only.
finalize_timetimestampWhen the invoice was finalized. Output only.
due_timetimestampWhen payment is due. Output only.
paid_timetimestampWhen the invoice was paid in full. Output only.
completenessdoubleThe share of the period's usage that had reached Billing when the invoice was finalized, from 0 to 1; below 1 the invoice carries a note. Output only.
credit_notesCreditNote[]Credit notes issued against this invoice, oldest first. Output only.
settlementsInvoiceSettlement[]Immutable authorized external payment records, oldest first. Output only.

ResourceMeta

FieldTypeWhat it is
generationint64Increases by one on every change to spec. Output only.
etagstringStrong ETag (AIP-154): changes on any change to spec, status, or metadata. Send it back as If-Match or etag to make Update and Delete conditional; a mismatch fails with ABORTED / 409 ETAG_MISMATCH. Output only.
create_timetimestampWhen the Resource was created. Output only.
update_timetimestampWhen the Resource last changed. Output only.
delete_timetimestampSet while the Resource is being deleted. Output only.
labelsmap<string, string>Caller-writable, indexed labels (AIP-122 label rules).
annotationsmap<string, string>Caller-writable, unindexed annotations.
display_namestringCaller-writable human-readable name.
creatorstringThe principal that created the Resource. Output only.

InvoiceLine

FieldTypeWhat it is
kindInvoiceLineKindWhat the line charges for. Output only. One of fee, usage, late_usage, credit, proration.
descriptionstringA customer-safe description. Output only.
servicestringThe service the line belongs to; empty for the plan fee. Output only.
meterstringThe meter id, for usage lines. Output only.
meter_versionint32The meter version, for usage lines. Output only.
dimensionsmap<string, string>The dimensions the price matched. Output only.
tierint32The price tier, from 1. Output only.
quantityint64The rated quantity, in the meter's base unit. Output only.
unit_amount_minorRationalThe price per base unit. Output only.
amountMoneyThe line amount in minor units. Project usage lines share the half-even rounded org price total; deterministic residual allocation conserves it. Output only.
projectstringThe project whose usage this line rates. Empty for org-level lines and historical invoices without recorded project attribution. Included allowances are pooled per org and price, never duplicated per project. Output only.
shadow_costMoneySylphx's internal cost to serve, never billed. Returned only on GET/List to an authenticated org-wide platform credential holding billing:read and the internal cost-read scope; absent from customer and recordPayment responses. Unset without a recorded shadow price. Project costs conserve rounded org COGS per price by the same deterministic allocation. Output only.

Money

FieldTypeWhat it is
currency_codestringISO 4217 currency, for example USD. Required.
units_minorint64The amount in the currency's minor unit (cents for USD). Required.

CreditNote

FieldTypeWhat it is
numberstringThe human-readable credit note number. Output only.
totalMoneyThe amount credited. Output only.
reasonstringA customer-safe reason. Output only.
issue_timetimestampWhen the credit note was issued. Output only.

InvoiceSettlement

FieldTypeWhat it is
payment_idstringDeterministic identity of the recorded payment. Output only.
payment_methodstringcard, invoice, or internal_settlement. Output only.
settlement_referencestringExternal provider, bank or internal journal reference. Output only.
amountMoneyThe exact full outstanding amount settled. Output only.
record_timetimestampWhen Billing recorded the payment. Output only.
recorderstringPrincipal from the verified seller Access grant, never supplied by the request. Output only.

Rational

FieldTypeWhat it is
numeratorint64The numerator. Required.
denominatorint64The denominator; never zero. Required.

Errors

Every error arrives in the body Errors describes.

Examples

curl -X POST "https://api.sylphx.com/v1/orgs/acme/invoices/invoice:recordPayment" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":{"currency_code":"…","units_minor":1},"payment_method":"…","settlement_reference":"…"}'