curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"payment_method": "cash",
"cash_register_id": "<string>",
"discount_received": 123,
"paid_at": "<string>",
"money_account_id": "<string>",
"reference": "<string>"
}
'import requests
url = "https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments"
payload = {
"amount": 123,
"payment_method": "cash",
"cash_register_id": "<string>",
"discount_received": 123,
"paid_at": "<string>",
"money_account_id": "<string>",
"reference": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
payment_method: 'cash',
cash_register_id: '<string>',
discount_received: 123,
paid_at: '<string>',
money_account_id: '<string>',
reference: '<string>'
})
};
fetch('https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'payment_method' => 'cash',
'cash_register_id' => '<string>',
'discount_received' => 123,
'paid_at' => '<string>',
'money_account_id' => '<string>',
'reference' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments"
payload := strings.NewReader("{\n \"amount\": 123,\n \"payment_method\": \"cash\",\n \"cash_register_id\": \"<string>\",\n \"discount_received\": 123,\n \"paid_at\": \"<string>\",\n \"money_account_id\": \"<string>\",\n \"reference\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"payment_method\": \"cash\",\n \"cash_register_id\": \"<string>\",\n \"discount_received\": 123,\n \"paid_at\": \"<string>\",\n \"money_account_id\": \"<string>\",\n \"reference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"payment_method\": \"cash\",\n \"cash_register_id\": \"<string>\",\n \"discount_received\": 123,\n \"paid_at\": \"<string>\",\n \"money_account_id\": \"<string>\",\n \"reference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"vendor_id": "<string>",
"vendor_credit_payment_id": "<string>",
"payment_method": "<string>",
"cash_register_id": "<string>",
"money_account_id": "<string>",
"amount": 123,
"discount_received": 123,
"paid_at": "2023-11-07T05:31:56Z",
"currency_code": "<string>",
"currency_exponent": 123,
"reference": "<string>",
"purchase": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}Pay a purchase
Records a cash payment made to the supplier for a non-credit purchase, with an optional settlement discount, from a cash register.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"payment_method": "cash",
"cash_register_id": "<string>",
"discount_received": 123,
"paid_at": "<string>",
"money_account_id": "<string>",
"reference": "<string>"
}
'import requests
url = "https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments"
payload = {
"amount": 123,
"payment_method": "cash",
"cash_register_id": "<string>",
"discount_received": 123,
"paid_at": "<string>",
"money_account_id": "<string>",
"reference": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
payment_method: 'cash',
cash_register_id: '<string>',
discount_received: 123,
paid_at: '<string>',
money_account_id: '<string>',
reference: '<string>'
})
};
fetch('https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'payment_method' => 'cash',
'cash_register_id' => '<string>',
'discount_received' => 123,
'paid_at' => '<string>',
'money_account_id' => '<string>',
'reference' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments"
payload := strings.NewReader("{\n \"amount\": 123,\n \"payment_method\": \"cash\",\n \"cash_register_id\": \"<string>\",\n \"discount_received\": 123,\n \"paid_at\": \"<string>\",\n \"money_account_id\": \"<string>\",\n \"reference\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"payment_method\": \"cash\",\n \"cash_register_id\": \"<string>\",\n \"discount_received\": 123,\n \"paid_at\": \"<string>\",\n \"money_account_id\": \"<string>\",\n \"reference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchases/{purchase}/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"payment_method\": \"cash\",\n \"cash_register_id\": \"<string>\",\n \"discount_received\": 123,\n \"paid_at\": \"<string>\",\n \"money_account_id\": \"<string>\",\n \"reference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"vendor_id": "<string>",
"vendor_credit_payment_id": "<string>",
"payment_method": "<string>",
"cash_register_id": "<string>",
"money_account_id": "<string>",
"amount": 123,
"discount_received": 123,
"paid_at": "2023-11-07T05:31:56Z",
"currency_code": "<string>",
"currency_exponent": 123,
"reference": "<string>",
"purchase": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}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.
- 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.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the purchase (27-character KSUID).
Query Parameters
Response mode. Default none; none answers 204 No Content.
none, resource 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.
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
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. Required; only cash is accepted for now, paid from the cash register named in cash_register_id.
cash 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.
27Settlement discount obtained from the supplier, in major units, zero or more. Defaults to 0 when omitted. It counts against the amount still owed.
Not accepted: the payment time is set by the server.
Not accepted: only cash payments from a cash register are enabled for now.
Free reference for the payment, for example a receipt number. Up to 255 characters.
255Response
Resource (only with response=resource).
Identifier of the purchase payment (27-character KSUID string).
Identifier of the purchase that was paid.
Identifier of the supplier, copied from the purchase.
Identifier of the supplier payment this payment is a share of; null for a payment made directly on the purchase.
How the payment was made. Only cash is accepted today.
Identifier of the cash register the money came from.
Identifier of the money account used. Always null for payments made through the API today, which only accept cash registers.
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.
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.
Date and time of the payment (ISO 8601). Set by the server.
Three-letter currency code of the payment (the company currency).
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.
Free reference supplied with the payment, for example a receipt number.
The paid purchase. Present only when requested with include=purchase.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).