POST
Pay a purchase
Company space Cannot be undone For: Buyer, Accountant · Permission: purchase_payments.create Conditions
  • A credit purchase is refused: it is settled through the supplier payment action instead.
  • The purchase must have a recognized supplier invoice.
  • The purchase status must be pending, completed or closed.
  • payment_method must be cash. money_account_id is refused: bank and mobile-money payments are not enabled.
  • cash_register_id is required and must be a register of the company that has a cash account linked. Exowpee does not check that the register is open.
  • amount must be above zero and discount_received, when sent, zero or more; neither can have more decimals than the currency exponent.
  • The amount plus the discount cannot exceed what is still owed on the purchase, which is the invoice plus delivery fees the company owes, minus earlier payments and discounts, debt adjustments and credit-note returns.
  • paid_at is refused: the server sets it.
What else happens
  • Records the payment with the current time and the company currency.
  • Recalculates the purchase’s amount paid, remaining amount and payment status (unpaid, partial or paid).
  • No accounting entry is posted by this action.
Part of Pay suppliers and adjust debt.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

purchase
string
required

Identifier of the purchase (27-character KSUID).

Query Parameters

response
enum<string>
default:none

Response mode. Default none; none answers 204 No Content.

Available options:
none,
resource
fields
string

Comma-separated JSON keys of the root resource (id is always rendered). Available: id, purchase_id, vendor_id, vendor_credit_payment_id, payment_method, cash_register_id, money_account_id, amount, discount_received, paid_at, currency_code, currency_exponent, reference, created_at, updated_at.

include
string

Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: purchase, purchase.items, purchase.debtAdjustments, purchase.returns, purchase.pickups, purchase.deliveries, purchase.vendor.

Body

application/json
amount
number
required

Amount paid in cash to the supplier, in major units, above zero. Together with discount_received it cannot exceed what is still owed on the purchase.

payment_method
enum<string>
required

Payment method. Required; only cash is accepted for now, paid from the cash register named in cash_register_id.

Available options:
cash
cash_register_id
string
required

Identifier of the cash register paying (27-character KSUID string). Required; it must be a register of the current company with a cash account linked.

Required string length: 27
discount_received
number | null

Settlement discount obtained from the supplier, in major units, zero or more. Defaults to 0 when omitted. It counts against the amount still owed.

paid_at
string

Not accepted: the payment time is set by the server.

money_account_id
string

Not accepted: only cash payments from a cash register are enabled for now.

reference
string | null

Free reference for the payment, for example a receipt number. Up to 255 characters.

Maximum string length: 255

Response

Resource (only with response=resource).

id

Identifier of the purchase payment (27-character KSUID string).

purchase_id

Identifier of the purchase that was paid.

vendor_id

Identifier of the supplier, copied from the purchase.

vendor_credit_payment_id

Identifier of the supplier payment this payment is a share of; null for a payment made directly on the purchase.

payment_method

How the payment was made. Only cash is accepted today.

cash_register_id

Identifier of the cash register the money came from.

money_account_id

Identifier of the money account used. Always null for payments made through the API today, which only accept cash registers.

amount
number

Amount paid to the supplier in major units (the minor-unit amount divided by 10 to the power currency_exponent), using the payment's own currency_exponent.

discount_received
number

Settlement discount granted by the supplier with this payment in major units (the minor-unit amount divided by 10 to the power currency_exponent); it reduces the debt like a payment but is not cash. 0 when none.

paid_at

Date and time of the payment (ISO 8601). Set by the server.

currency_code

Three-letter currency code of the payment (the company currency).

currency_exponent
integer

Number of decimal places of the currency (0 for XOF). An amount in minor units divided by 10 to this power gives the amount in the currency.

reference

Free reference supplied with the payment, for example a receipt number.

purchase
object

The paid purchase. Present only when requested with include=purchase.

created_at

Date and time the record was created (ISO 8601, UTC).

updated_at

Date and time the record was last changed (ISO 8601, UTC).