Aller au contenu

POST /v1/invoices/{id}/payments

POST
/v1/invoices/{id}/payments
curl --request POST \
--url https://api.asap.cool/v1/invoices/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "amount": 1, "method": "example", "paid_at": "example", "reference": "example" }'
id
required
string format: uuid

Document identifier.

Media type application/json

Body of POST /v1/invoices/{id}/payments. org_id is never accepted here.

object
amount
required

Amount received, in cents (strictly positive).

integer format: int64
method

Payment method (free-form), e.g. "virement".

string | null
paid_at

Settlement date (YYYY-MM-DD); defaults to now when omitted.

string | null
reference

Free-form payment reference.

string | null
Example generated
{
"amount": 1,
"method": "example",
"paid_at": "example",
"reference": "example"
}

Payment recorded; balance/status recomputed.

Media type application/json

The recomputed balance/status returned after a record or delete.

object
payment
One of:
null
remaining_due
required

total_ttc - total_paid, in cents (negative on overpayment).

integer format: int64
status
required

Document status after the automatic paid/sent transition.

string
total_paid
required

Sum of all payments against the document, in cents.

integer format: int64
Example generated
{
"payment": {
"amount": 1,
"created_at": "example",
"document_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"method": "example",
"paid_at": "example",
"reference": "example"
},
"remaining_due": 1,
"status": "example",
"total_paid": 1
}

No active org.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}

Missing invoice:write scope.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}

Not found or cross-org.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}

Invalid amount/date, or the document is not payable (quote/draft/terminal).

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}