Оплати
Оплати угод, повернення та способи оплати організації.
Платники рахунків
GET /billing-entities
Хто виставляє рахунки організації: префікс і нумерація номерів, строк оплати, валюта й часовий пояс. Лише читання; main з’являється з першим рахунком.
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/billing-entities' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/billing-entities', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/billing-entities",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/billing-entities', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"items": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b0",
"code": "main",
"name": "ТОВ «Кавова гільдія»",
"legalName": null,
"documentNumberPrefix": "KAV",
"documentNumbering": "per_billing_entity",
"netPaymentTerm": 0,
"defaultCurrency": "UAH",
"timezone": "Europe/Kyiv",
"pricesIncludeTax": true,
"taxRateId": "0192f3a1-7c2e-7b4d-9a61-000000000c01"
}
]
}Поля відповіді
itemsobject[]Вкладені поля: 11
codestringdefaultCurrencystringшаблон
^[A-Z]{3}$documentNumberPrefixstringdocumentNumberingstringЗначення:
per_customerper_billing_entityidstring · uuidlegalNamestring | nullnamestringnetPaymentTerminteger≥ 0
pricesIncludeTaxbooleantaxRateIdstring · uuid | nulltimezonestring
Податки продавця
PATCH /billing-entities/{billingEntityId}
Потрібна сторінка «Товари» в ролі. pricesIncludeTax — «Ціни включають податок»: податок виділяється з ціни рядка, інакше додається зверху і сума угоди зростає на нього; taxRateId — ставка за замовчуванням, яку бере рядок товару без своєї ставки (null — без неї). Стосується рядків, які додадуть після зміни: рядок, що вже стоїть в угоді, зберігає свій податок. Поле, яке не надіслали, лишається. Ставки немає — 400, ставка в архіві — 409 tax_rate_archived. Поки рахунки всіх угод виставляє продавець main, інший продавець — 409 only_main_seller.
Параметри шляху
billingEntityIdstring · uuid обов’язково
Тіло запиту
pricesIncludeTaxbooleantaxRateIdstring · uuid | null
Приклад запиту
curl -X PATCH 'https://your-company.altahub.ai/api/v1/billing-entities/{billingEntityId}' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"pricesIncludeTax": true,
"taxRateId": "0192f3a1-7c2e-7b4d-9a61-000000000c01"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/billing-entities/{billingEntityId}', {
method: 'PATCH',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
pricesIncludeTax: true,
taxRateId: '0192f3a1-7c2e-7b4d-9a61-000000000c01',
}),
});
const data = await response.json();import requests
response = requests.patch(
"https://your-company.altahub.ai/api/v1/billing-entities/{billingEntityId}",
headers={"Authorization": "Bearer alta_…"},
json={
"pricesIncludeTax": True,
"taxRateId": "0192f3a1-7c2e-7b4d-9a61-000000000c01",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PATCH', 'https://your-company.altahub.ai/api/v1/billing-entities/{billingEntityId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'pricesIncludeTax' => true,
'taxRateId' => '0192f3a1-7c2e-7b4d-9a61-000000000c01',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b0",
"code": "main",
"name": "ТОВ «Кавова гільдія»",
"legalName": null,
"documentNumberPrefix": "KAV",
"documentNumbering": "per_billing_entity",
"netPaymentTerm": 0,
"defaultCurrency": "UAH",
"timezone": "Europe/Kyiv",
"pricesIncludeTax": true,
"taxRateId": "0192f3a1-7c2e-7b4d-9a61-000000000c01"
}Поля відповіді
codestringdefaultCurrencystringшаблон
^[A-Z]{3}$documentNumberPrefixstringdocumentNumberingstringЗначення:
per_customerper_billing_entityidstring · uuidlegalNamestring | nullnamestringnetPaymentTerminteger≥ 0
pricesIncludeTaxbooleantaxRateIdstring · uuid | nulltimezonestring
Рахунки угоди
GET /deals/{dealId}/invoices
Рахунки угоди, нові зверху, з рядками, оплатами (скасована лишається — failed) і поверненнями; що лишилося сплатити й чи прострочено. totals — підсумки за валютами. Платіж частинами — це рахунок у статусі pending з датою paymentDueDate. Суми — у копійках (*Cents).
Параметри шляху
dealIdstring · uuid обов’язково
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/deals/{dealId}/invoices' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/invoices', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/invoices",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/invoices', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"items": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b2",
"dealId": "0192f3a1-7c2e-7b4d-9a61-000000000014",
"billingEntityCode": "main",
"number": "KAV-202610-002",
"invoiceType": "one_off",
"status": "finalized",
"paymentStatus": "pending",
"paymentOverdue": false,
"issuingDate": "2026-10-23",
"paymentDueDate": "2026-10-30",
"netPaymentTerm": 7,
"currency": "UAH",
"feesAmountCents": 600000,
"taxesAmountCents": 0,
"totalAmountCents": 600000,
"totalPaidAmountCents": 0,
"totalDueAmountCents": 600000,
"totalRefundedAmountCents": 0,
"voidedAt": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": null,
"paymentFields": [],
"source": "alta",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"version": 1,
"fees": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b5",
"invoiceDisplayName": "Кавомашини для мережі кав’ярень",
"description": null,
"units": "1",
"unitAmountCents": 600000,
"amountCents": 600000,
"taxesAmountCents": 0
}
],
"couponsAmountCents": 0,
"discounts": [],
"payments": [],
"createdAt": "2026-10-23T10:30:00Z"
},
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b1",
"dealId": "0192f3a1-7c2e-7b4d-9a61-000000000014",
"billingEntityCode": "main",
"number": "KAV-202610-001",
"invoiceType": "one_off",
"status": "finalized",
"paymentStatus": "succeeded",
"paymentOverdue": false,
"issuingDate": "2026-10-23",
"paymentDueDate": "2026-10-23",
"netPaymentTerm": 0,
"currency": "UAH",
"feesAmountCents": 600000,
"taxesAmountCents": 0,
"totalAmountCents": 600000,
"totalPaidAmountCents": 600000,
"totalDueAmountCents": 0,
"totalRefundedAmountCents": 0,
"voidedAt": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"source": "alta",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"version": 1,
"fees": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b4",
"invoiceDisplayName": "Кавомашини для мережі кав’ярень",
"description": null,
"units": "1",
"unitAmountCents": 600000,
"amountCents": 600000,
"taxesAmountCents": 0
}
],
"couponsAmountCents": 0,
"discounts": [],
"payments": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b3",
"paymentType": "manual",
"paymentStatus": "succeeded",
"amountCents": 600000,
"currency": "UAH",
"paidAt": "2026-10-23T10:30:00Z",
"reference": "deal:1042",
"orderReference": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"canceledAt": null,
"cancelReason": null,
"refundableAmountCents": 600000,
"refunds": [],
"source": "alta",
"version": 1,
"createdAt": "2026-10-23T10:30:00Z"
}
],
"createdAt": "2026-10-23T10:30:00Z"
}
],
"totals": [
{
"currency": "UAH",
"totalAmountCents": 1200000,
"totalPaidAmountCents": 600000,
"totalRefundedAmountCents": 0,
"totalDueAmountCents": 600000
}
]
}Поля відповіді
itemsobject[]Вкладені поля: 34
billingEntityCodestringcommentstring | nullcouponsAmountCentsinteger0–9007199254740991
createdAtstring · date-timecreatedByobject | nullВкладені поля: 2
idstring · uuidnamestring
currencystringшаблон
^[A-Z]{3}$dealIdstring · uuiddiscountsobject[]Вкладені поля: 3
amountCentsinteger0–9007199254740991
kindstringЗначення:
couponmanualnamestring | null
feesobject[]Вкладені поля: 11
amountCentsinteger0–9007199254740991
descriptionstring | nullidstring · uuidinvoiceDisplayNamestring | nulltaxesAmountCentsinteger0–9007199254740991
unitAmountCentsinteger0–9007199254740991
unitsstringproductIdstring · uuid | nullrateIdstring · uuid | nulltaxesobject[]Вкладені поля: 6
amountCentsinteger0–9007199254740991
baseAmountCentsinteger0–9007199254740991
inclusivebooleannamestringratestringшаблон
^[0-9]{1,3}\.[0-9]{2}$taxRateIdstring · uuid
unitAmountExcludingTaxstringшаблон
^[0-9]+(\.[0-9]{1,6})?$
feesAmountCentsinteger0–9007199254740991
idstring · uuidinvoiceTypestringЗначення:
one_offcreditissuingDatestring · datemethodstring | nullmethodIdstring · uuid | nullnetPaymentTerminteger≥ 0
numberstringpaymentDueDatestring · datepaymentFieldsobject[]Вкладені поля: 2
fieldIdstring · uuidvaluestring | boolean | string[] · uuid | objectВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstringcurrencystring
Варіант 5 · object
citystringcountrystringlinestringpostcodestring
paymentOverduebooleanpaymentStatusstringЗначення:
pendingsucceededfailedpaymentsobject[]Вкладені поля: 19
amountCentsinteger0–9007199254740991
cancelReasonstring | nullcanceledAtstring · date-time | nullcommentstring | nullcreatedAtstring · date-timecurrencystringшаблон
^[A-Z]{3}$idstring · uuidmethodstring | nullmethodIdstring · uuid | nullorderReferencestring | nullpaidAtstring · date-time | nullpaymentFieldsobject[]Вкладені поля: 2
fieldIdstring · uuidvaluestring | boolean | string[] · uuid | objectВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstringcurrencystring
Варіант 5 · object
citystringcountrystringlinestringpostcodestring
paymentStatusstringЗначення:
pendingprocessingsucceededfailedpaymentTypestringЗначення:
manualproviderreferencestring | nullrefundableAmountCentsinteger0–9007199254740991
refundsobject[]Вкладені поля: 7
amountCentsinteger0–9007199254740991
createdAtstring · date-timecreatedByobject | nullВкладені поля: 2
idstring · uuidnamestring
idstring · uuidreasonstring | nullrefundedAtstring · date-time | nullstatusstringЗначення:
pendingsucceededfailed
sourcestringversioninteger≥ 1
sourcestringstatusstringЗначення:
draftfinalizedvoidedfailedpendingtaxesAmountCentsinteger0–9007199254740991
totalAmountCentsinteger0–9007199254740991
totalDueAmountCentsinteger0–9007199254740991
totalPaidAmountCentsinteger0–9007199254740991
totalRefundedAmountCentsinteger0–9007199254740991
versioninteger≥ 1
voidedAtstring · date-time | nullappliedTaxesobject[]Вкладені поля: 6
amountCentsinteger0–9007199254740991
baseAmountCentsinteger0–9007199254740991
inclusivebooleannamestringratestringшаблон
^[0-9]{1,3}\.[0-9]{2}$taxRateIdstring · uuid
declinedobjectВкладені поля: 1
reasonstringЗначення:
payer_canceledrefusedexpiredwithdrawninsufficient_fundscard_velocity_exceededexpired_cardincorrect_card_detailsauthentication_failedissuer_declinedfraudulentinstalment_refusedprocessing_error
paymentIdstring · uuid
totalsobject[]Вкладені поля: 5
currencystringшаблон
^[A-Z]{3}$totalAmountCentsinteger0–9007199254740991
totalDueAmountCentsinteger0–9007199254740991
totalPaidAmountCentsinteger0–9007199254740991
totalRefundedAmountCentsinteger0–9007199254740991
Виставити рахунок
POST /deals/{dealId}/invoices
Рядки (fees) або одна сума (amountCents, рядок з назвою угоди), валюта, дата оплати (paymentDueDate; без неї — одразу). З payment рахунок одразу сплачено повністю — це «Записати оплату» в один клік; payment.paidAt не в майбутньому (400). Угода в кошику — 409. idempotencyKey робить повтор безпечним. У payment.orderReference — ваш номер замовлення: в організації одне замовлення — одна оплата, хто б її не записав (API, платіжний сервіс, звірка, імпорт). Замовлення вже має оплату на цій угоді — відповідь 201 з рахунком тієї оплати, другої не буде; повтор безпечний, навіть коли idempotencyKey дорівнює orderReference. Ви важливіші за імпорт і за здогад за телефоном: оплату від платіжного сервісу, яку за телефоном чи e-mail поклало на іншу угоду або яка чекає в «Нерозібраних оплатах», а також оплату, яку імпорт записав на іншу угоду, буде перенесено на цю угоду, і саме до неї лягатимуть його повернення. На іншій угоді лишиться анульований рахунок без грошей і два рядки історії: її підсумки такі, ніби оплати там не було; наступні кроки імпорту її не повернуть. Оплату до іншої угоди прив’язала людина — 409 order_linked_by_person; її вже записали на іншу угоду через API, поклало туди посилання на оплату чи номер угоди в замовленні, на угоду, яку ви не можете змінювати, або угода в кошику — 409 order_on_another_deal, тож застарілий запит не поверне оплату назад; на ній уже є повернення — 409 order_refunded_on_another_deal. Сума оплати лишається такою, як записано вперше. Інший запит записав це саме замовлення в ту саму секунду — 409 order_taken; оплату замовлення в ту саму секунду скасували — 409 order_payment_canceled. Обидві відповіді можна повторити: той самий запит ще раз отримає відповідь за правилом. «Обов’язково під час оплати» зупиняє лише оплату, яку записує людина в Alta: оплату через API не зупиняє. Значення таких полів можна передати в customFields — вони запишуться в угоду разом з оплатою. Сума (amountCents), що дорівнює підсумку вибраних рядків угоди до її купонів і знижки, поки вони на цих рядках є, — 409 stale_client_reload: вікно відкрито до знижок, оновіть сторінку. manualDiscount («Знижка на все») — знижка угоди на всю угоду відтепер, percent (більше 0, не більше 100) від того, що лишилося від угоди, або amount у її валюті; null її знімає. Записується в угоду під час виставлення, після знижок рядків і товарів вікна й до того, як рахунок бере рядки, як її пише PUT /deals/{dealId}/discounts/manual: ділиться між рядками самої угоди (товар лише цієї оплати частки не отримує), у межах «Максимальної знижки, %» ролі (403 discount_above_role_cap), з правом «Змінювати ціну в угоді» (403; знижка угоди, надіслана як є, права не питає); 409 imported_lines, amount_kept_by_sync, amount_not_from_products. Повтор з тим самим ключем удруге її не пише.
Параметри шляху
dealIdstring · uuid обов’язково
Тіло запиту
currencystring обов’язковошаблон
^[A-Z]{3}$idempotencyKeystring обов’язковошаблон
^[\x21-\x7e]{1,255}$amountCentsinteger1–9007199254740991
commentstring | nullдовжина ≤ 1000
customFieldsobject[]кількість ≤ 100
Вкладені поля: 2
fieldIdstring · uuid обов’язковоvaluestring | boolean | string[] · uuid | object | null обов’язковоВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstring обов’язководовжина ≤ 40
currencystring обов’язководовжина ≤ 3
Варіант 5 · object
citystring | nullдовжина ≤ 200
countrystring | nullдовжина ≤ 200
linestring | nullдовжина ≤ 600
postcodestring | nullдовжина ≤ 40
feesobject[]кількість 1–100
Вкладені поля: 4
unitAmountCentsinteger обов’язково0–9007199254740991
descriptionstring | nullдовжина ≤ 1000
invoiceDisplayNamestringдовжина ≤ 200
unitsstringшаблон
^[0-9]{1,12}(\.[0-9]{1,6})?$
manualDiscountobject | nullВкладені поля: 2
typestring обов’язковоA percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit
Значення:
percentamountvaluestring | number обов’язковошаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99
methodIdstring · uuid | nullpaymentobject | nullВкладені поля: 2
orderReferencestringдовжина 1–200 · шаблон
^(?=.*\S)[^\u0000-\u001f\u007f-\u009f]+$paidAtstring · date-time
paymentDueDatestring · date | nullpaymentFieldsobject[]кількість ≤ 100
Вкладені поля: 2
fieldIdstring · uuid обов’язковоvaluestring | boolean | string[] · uuid | object | null обов’язковоВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstring обов’язководовжина ≤ 40
currencystring обов’язководовжина ≤ 3
Варіант 5 · object
citystring | nullдовжина ≤ 200
countrystring | nullдовжина ≤ 200
linestring | nullдовжина ≤ 600
postcodestring | nullдовжина ≤ 40
productLineDiscountsobject[]A discount given in the payment window to the deal's lines it is for, each line once (another time is 400 `duplicate_product_line` at its place): `discount`, per unit, a `percent` (more than 0, at most 100) or an `amount` of the line's currency (more than 0), off the line's own price before its discount, is the line's discount from now on (`null`: none), as PATCH /deals/{dealId}/products/{lineId} takes it with `discount`. A line that is not among the lines the payment is for (`productLineIds`) is 400 `product_line_not_chosen` at its place; giving, changing or taking off a discount needs deals.price (403 otherwise), one left as it is asks nothing; a line another system recorded is 409 imported_line, a discount given on a deal whose amount another system's import writes 409 amount_kept_by_sync. The payment takes the line at its new price, and the line itself takes it (its history, the deal's amount following) in the same transaction, only when this call issues the payment: a repeat, and an order whose payment stands already, change no line
кількість ≤ 500
Вкладені поля: 2
discountobject | null обов’язковоВкладені поля: 2
typestring обов’язковоA percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit
Значення:
percentamountvaluestring | number обов’язковошаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99
productLineIdstring · uuid обов’язково
productLineIdsstring[] · uuidWhich of the deal's product lines the invoice bills, by their ids (`GET /deals/{dealId}/products`): absent or `[]`, none. A line that is not this deal's is 400 `product_line_not_found` at its place. Each is copied as it is now: its name, quantity, unit price, product and the rate it sold at
кількість ≤ 500 · без повторів
productsobject[]Products of the catalog sold with it, besides the deal's lines (`productLineIds`), each in the deal's currency: `priceId` one of its prices there (absent: the one the catalog offers first there), `quantity` (default 1), or `price`, a unit price of one's own (permission deals.price, 403 otherwise); `discount` (optional, permission deals.price, else 403), per unit, a `percent` (more than 0, at most 100) or an `amount` of the deal's currency (more than 0) off that price, as POST /deals/{dealId}/products takes it: the product sells at that price less the discount, rounded half up to the cent and never below 0 (409 amount_kept_by_sync on a deal whose amount another system's import writes). A product that is not the organization's is 400 `product_not_found` at its place; an archived one 409 `product_archived`; no price in the deal's currency and none typed 409 `no_price_in_currency`. When the organization's «Товар при оплате» says a product chosen at payment is added to the deal's products, each becomes a line of the deal in the same transaction (its amount following, its history), with its discount, unless the deal holds another system's lines
кількість ≤ 100
Вкладені поля: 5
productIdstring · uuid обов’язковоdiscountobjectВкладені поля: 2
typestring обов’язковоA percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit
Значення:
percentamountvaluestring | number обов’язковошаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99
pricestring | numberшаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99priceIdstring · uuidquantitystring | numberшаблон
^[0-9]{1,8}(\.[0-9]{1,3})?$· > 0, ≤ 99999999.999
taxAwarebooleanThe client knows the deal lines' taxes added on top (ADR-0032 stage 4): an amount equal to the named lines' total without them is a part it means, never taken for a window opened before taxes (409 stale_client_reload otherwise)
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/deals/{dealId}/invoices' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"currency": "UAH",
"amountCents": 600000,
"payment": {
"paidAt": "2026-10-23T10:30:00Z",
"orderReference": "ORDER-20431"
},
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"idempotencyKey": "6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/invoices', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
currency: 'UAH',
amountCents: 600000,
payment: {
paidAt: '2026-10-23T10:30:00Z',
orderReference: 'ORDER-20431',
},
methodId: '0192f3a1-7c2e-7b4d-9a61-000000000048',
comment: 'Передоплата 50%',
idempotencyKey: '6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07',
}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/invoices",
headers={"Authorization": "Bearer alta_…"},
json={
"currency": "UAH",
"amountCents": 600000,
"payment": {
"paidAt": "2026-10-23T10:30:00Z",
"orderReference": "ORDER-20431",
},
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"idempotencyKey": "6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/invoices', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'currency' => 'UAH',
'amountCents' => 600000,
'payment' => [
'paidAt' => '2026-10-23T10:30:00Z',
'orderReference' => 'ORDER-20431',
],
'methodId' => '0192f3a1-7c2e-7b4d-9a61-000000000048',
'comment' => 'Передоплата 50%',
'idempotencyKey' => '6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 201
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b1",
"dealId": "0192f3a1-7c2e-7b4d-9a61-000000000014",
"billingEntityCode": "main",
"number": "KAV-202610-001",
"invoiceType": "one_off",
"status": "finalized",
"paymentStatus": "succeeded",
"paymentOverdue": false,
"issuingDate": "2026-10-23",
"paymentDueDate": "2026-10-23",
"netPaymentTerm": 0,
"currency": "UAH",
"feesAmountCents": 600000,
"taxesAmountCents": 0,
"totalAmountCents": 600000,
"totalPaidAmountCents": 600000,
"totalDueAmountCents": 0,
"totalRefundedAmountCents": 0,
"voidedAt": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"source": "alta",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"version": 1,
"fees": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b4",
"invoiceDisplayName": "Кавомашини для мережі кав’ярень",
"description": null,
"units": "1",
"unitAmountCents": 600000,
"amountCents": 600000,
"taxesAmountCents": 0
}
],
"couponsAmountCents": 0,
"discounts": [],
"payments": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b3",
"paymentType": "manual",
"paymentStatus": "succeeded",
"amountCents": 600000,
"currency": "UAH",
"paidAt": "2026-10-23T10:30:00Z",
"reference": "deal:1042",
"orderReference": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"canceledAt": null,
"cancelReason": null,
"refundableAmountCents": 600000,
"refunds": [],
"source": "alta",
"version": 1,
"createdAt": "2026-10-23T10:30:00Z"
}
],
"createdAt": "2026-10-23T10:30:00Z"
}Поля відповіді
billingEntityCodestringcommentstring | nullcouponsAmountCentsinteger0–9007199254740991
createdAtstring · date-timecreatedByobject | nullВкладені поля: 2
idstring · uuidnamestring
currencystringшаблон
^[A-Z]{3}$dealIdstring · uuiddiscountsobject[]Вкладені поля: 3
amountCentsinteger0–9007199254740991
kindstringЗначення:
couponmanualnamestring | null
feesobject[]Вкладені поля: 11
amountCentsinteger0–9007199254740991
descriptionstring | nullidstring · uuidinvoiceDisplayNamestring | nulltaxesAmountCentsinteger0–9007199254740991
unitAmountCentsinteger0–9007199254740991
unitsstringproductIdstring · uuid | nullrateIdstring · uuid | nulltaxesobject[]Вкладені поля: 6
amountCentsinteger0–9007199254740991
baseAmountCentsinteger0–9007199254740991
inclusivebooleannamestringratestringшаблон
^[0-9]{1,3}\.[0-9]{2}$taxRateIdstring · uuid
unitAmountExcludingTaxstringшаблон
^[0-9]+(\.[0-9]{1,6})?$
feesAmountCentsinteger0–9007199254740991
idstring · uuidinvoiceTypestringЗначення:
one_offcreditissuingDatestring · datemethodstring | nullmethodIdstring · uuid | nullnetPaymentTerminteger≥ 0
numberstringpaymentDueDatestring · datepaymentFieldsobject[]Вкладені поля: 2
fieldIdstring · uuidvaluestring | boolean | string[] · uuid | objectВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstringcurrencystring
Варіант 5 · object
citystringcountrystringlinestringpostcodestring
paymentOverduebooleanpaymentStatusstringЗначення:
pendingsucceededfailedpaymentsobject[]Вкладені поля: 19
amountCentsinteger0–9007199254740991
cancelReasonstring | nullcanceledAtstring · date-time | nullcommentstring | nullcreatedAtstring · date-timecurrencystringшаблон
^[A-Z]{3}$idstring · uuidmethodstring | nullmethodIdstring · uuid | nullorderReferencestring | nullpaidAtstring · date-time | nullpaymentFieldsobject[]Вкладені поля: 2
fieldIdstring · uuidvaluestring | boolean | string[] · uuid | objectВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstringcurrencystring
Варіант 5 · object
citystringcountrystringlinestringpostcodestring
paymentStatusstringЗначення:
pendingprocessingsucceededfailedpaymentTypestringЗначення:
manualproviderreferencestring | nullrefundableAmountCentsinteger0–9007199254740991
refundsobject[]Вкладені поля: 7
amountCentsinteger0–9007199254740991
createdAtstring · date-timecreatedByobject | nullВкладені поля: 2
idstring · uuidnamestring
idstring · uuidreasonstring | nullrefundedAtstring · date-time | nullstatusstringЗначення:
pendingsucceededfailed
sourcestringversioninteger≥ 1
sourcestringstatusstringЗначення:
draftfinalizedvoidedfailedpendingtaxesAmountCentsinteger0–9007199254740991
totalAmountCentsinteger0–9007199254740991
totalDueAmountCentsinteger0–9007199254740991
totalPaidAmountCentsinteger0–9007199254740991
totalRefundedAmountCentsinteger0–9007199254740991
versioninteger≥ 1
voidedAtstring · date-time | nullappliedTaxesobject[]Вкладені поля: 6
amountCentsinteger0–9007199254740991
baseAmountCentsinteger0–9007199254740991
inclusivebooleannamestringratestringшаблон
^[0-9]{1,3}\.[0-9]{2}$taxRateIdstring · uuid
declinedobjectВкладені поля: 1
reasonstringЗначення:
payer_canceledrefusedexpiredwithdrawninsufficient_fundscard_velocity_exceededexpired_cardincorrect_card_detailsauthentication_failedissuer_declinedfraudulentinstalment_refusedprocessing_error
paymentIdstring · uuid
Отримати рахунок
GET /invoices/{invoiceId}
Один рахунок угоди з рядками, оплатами й поверненнями.
Параметри шляху
invoiceIdstring · uuid обов’язково
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/invoices/{invoiceId}' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/invoices/{invoiceId}', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/invoices/{invoiceId}",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/invoices/{invoiceId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b1",
"dealId": "0192f3a1-7c2e-7b4d-9a61-000000000014",
"billingEntityCode": "main",
"number": "KAV-202610-001",
"invoiceType": "one_off",
"status": "finalized",
"paymentStatus": "succeeded",
"paymentOverdue": false,
"issuingDate": "2026-10-23",
"paymentDueDate": "2026-10-23",
"netPaymentTerm": 0,
"currency": "UAH",
"feesAmountCents": 600000,
"taxesAmountCents": 0,
"totalAmountCents": 600000,
"totalPaidAmountCents": 600000,
"totalDueAmountCents": 0,
"totalRefundedAmountCents": 0,
"voidedAt": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"source": "alta",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"version": 1,
"fees": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b4",
"invoiceDisplayName": "Кавомашини для мережі кав’ярень",
"description": null,
"units": "1",
"unitAmountCents": 600000,
"amountCents": 600000,
"taxesAmountCents": 0
}
],
"couponsAmountCents": 0,
"discounts": [],
"payments": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b3",
"paymentType": "manual",
"paymentStatus": "succeeded",
"amountCents": 600000,
"currency": "UAH",
"paidAt": "2026-10-23T10:30:00Z",
"reference": "deal:1042",
"orderReference": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"canceledAt": null,
"cancelReason": null,
"refundableAmountCents": 600000,
"refunds": [],
"source": "alta",
"version": 1,
"createdAt": "2026-10-23T10:30:00Z"
}
],
"createdAt": "2026-10-23T10:30:00Z"
}Поля — як у відповіді Виставити рахунок
Сплатити рахунок
POST /invoices/{invoiceId}/payments
Ручна оплата рахунку на всю суму до сплати (amountCents): менша — 409 partial_payment_not_supported, більша — 409 exceeds_amount_due. paidAt — коли надійшли гроші, не в майбутньому. idempotencyKey робить повтор безпечним. orderReference — ваш номер замовлення: в організації одне замовлення — одна оплата, хто б її не записав (API, платіжний сервіс, звірка, імпорт). Замовлення вже має оплату на цій угоді — відповідь 201 з рахунком тієї оплати, другої не буде; повтор безпечний, навіть коли idempotencyKey дорівнює orderReference. Ви важливіші за імпорт і за здогад за телефоном: оплату від платіжного сервісу, яку за телефоном чи e-mail поклало на іншу угоду або яка чекає в «Нерозібраних оплатах», а також оплату, яку імпорт записав на іншу угоду, буде перенесено на цю угоду, і саме до неї лягатимуть його повернення. На іншій угоді лишиться анульований рахунок без грошей і два рядки історії: її підсумки такі, ніби оплати там не було; наступні кроки імпорту її не повернуть. Оплату до іншої угоди прив’язала людина — 409 order_linked_by_person; її вже записали на іншу угоду через API, поклало туди посилання на оплату чи номер угоди в замовленні, на угоду, яку ви не можете змінювати, або угода в кошику — 409 order_on_another_deal, тож застарілий запит не поверне оплату назад; на ній уже є повернення — 409 order_refunded_on_another_deal. Сума оплати лишається такою, як записано вперше. Рахунок тієї самої суми, виставлений на цій угоді для цього замовлення, анулюється: він більше нічого не вимагає. Інший запит записав це саме замовлення в ту саму секунду — 409 order_taken; оплату замовлення в ту саму секунду скасували — 409 order_payment_canceled. Обидві відповіді можна повторити: той самий запит ще раз отримає відповідь за правилом. «Обов’язково під час оплати» зупиняє лише оплату, яку записує людина в Alta: оплату через API не зупиняє. Значення таких полів можна передати в customFields — вони запишуться в угоду разом з оплатою.
Параметри шляху
invoiceIdstring · uuid обов’язково
Тіло запиту
amountCentsinteger обов’язково1–9007199254740991
idempotencyKeystring обов’язковошаблон
^[\x21-\x7e]{1,255}$paidAtstring · date-time обов’язковоcommentstring | nullдовжина ≤ 1000
customFieldsobject[]кількість ≤ 100
Вкладені поля: 2
fieldIdstring · uuid обов’язковоvaluestring | boolean | string[] · uuid | object | null обов’язковоВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstring обов’язководовжина ≤ 40
currencystring обов’язководовжина ≤ 3
Варіант 5 · object
citystring | nullдовжина ≤ 200
countrystring | nullдовжина ≤ 200
linestring | nullдовжина ≤ 600
postcodestring | nullдовжина ≤ 40
methodIdstring · uuid | nullorderReferencestringдовжина 1–200 · шаблон
^(?=.*\S)[^\u0000-\u001f\u007f-\u009f]+$paymentFieldsobject[]кількість ≤ 100
Вкладені поля: 2
fieldIdstring · uuid обов’язковоvaluestring | boolean | string[] · uuid | object | null обов’язковоВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstring обов’язководовжина ≤ 40
currencystring обов’язководовжина ≤ 3
Варіант 5 · object
citystring | nullдовжина ≤ 200
countrystring | nullдовжина ≤ 200
linestring | nullдовжина ≤ 600
postcodestring | nullдовжина ≤ 40
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/invoices/{invoiceId}/payments' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"amountCents": 600000,
"paidAt": "2026-10-24T16:45:00Z",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000049",
"orderReference": "ORDER-20431",
"idempotencyKey": "6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/invoices/{invoiceId}/payments', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
amountCents: 600000,
paidAt: '2026-10-24T16:45:00Z',
methodId: '0192f3a1-7c2e-7b4d-9a61-000000000049',
orderReference: 'ORDER-20431',
idempotencyKey: '6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07',
}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/invoices/{invoiceId}/payments",
headers={"Authorization": "Bearer alta_…"},
json={
"amountCents": 600000,
"paidAt": "2026-10-24T16:45:00Z",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000049",
"orderReference": "ORDER-20431",
"idempotencyKey": "6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/invoices/{invoiceId}/payments', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'amountCents' => 600000,
'paidAt' => '2026-10-24T16:45:00Z',
'methodId' => '0192f3a1-7c2e-7b4d-9a61-000000000049',
'orderReference' => 'ORDER-20431',
'idempotencyKey' => '6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 201
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b2",
"dealId": "0192f3a1-7c2e-7b4d-9a61-000000000014",
"billingEntityCode": "main",
"number": "KAV-202610-002",
"invoiceType": "one_off",
"status": "finalized",
"paymentStatus": "succeeded",
"paymentOverdue": false,
"issuingDate": "2026-10-23",
"paymentDueDate": "2026-10-30",
"netPaymentTerm": 7,
"currency": "UAH",
"feesAmountCents": 600000,
"taxesAmountCents": 0,
"totalAmountCents": 600000,
"totalPaidAmountCents": 600000,
"totalDueAmountCents": 0,
"totalRefundedAmountCents": 0,
"voidedAt": null,
"method": "Картка",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000049",
"comment": null,
"paymentFields": [],
"source": "alta",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"version": 2,
"fees": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b5",
"invoiceDisplayName": "Кавомашини для мережі кав’ярень",
"description": null,
"units": "1",
"unitAmountCents": 600000,
"amountCents": 600000,
"taxesAmountCents": 0
}
],
"couponsAmountCents": 0,
"discounts": [],
"payments": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b3",
"paymentType": "manual",
"paymentStatus": "succeeded",
"amountCents": 600000,
"currency": "UAH",
"paidAt": "2026-10-24T16:45:00Z",
"reference": "deal:1042",
"orderReference": "ORDER-20431",
"method": "Картка",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000049",
"comment": null,
"paymentFields": [],
"canceledAt": null,
"cancelReason": null,
"refundableAmountCents": 600000,
"refunds": [],
"source": "alta",
"version": 2,
"createdAt": "2026-10-24T16:45:00Z"
}
],
"createdAt": "2026-10-23T10:30:00Z"
}Поля — як у відповіді Виставити рахунок
Анулювати рахунок
POST /invoices/{invoiceId}/void
Лише рахунок, за яким нічого не сплачено: він лишається з voided і більше нічого не вимагає. Сплачений — 409 invoice_paid (спершу скасуйте помилкову оплату).
Параметри шляху
invoiceIdstring · uuid обов’язково
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/invoices/{invoiceId}/void' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{}'const response = await fetch('https://your-company.altahub.ai/api/v1/invoices/{invoiceId}/void', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/invoices/{invoiceId}/void",
headers={"Authorization": "Bearer alta_…"},
json={},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/invoices/{invoiceId}/void', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => new \stdClass(),
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b2",
"dealId": "0192f3a1-7c2e-7b4d-9a61-000000000014",
"billingEntityCode": "main",
"number": "KAV-202610-002",
"invoiceType": "one_off",
"status": "voided",
"paymentStatus": "pending",
"paymentOverdue": false,
"issuingDate": "2026-10-23",
"paymentDueDate": "2026-10-30",
"netPaymentTerm": 7,
"currency": "UAH",
"feesAmountCents": 600000,
"taxesAmountCents": 0,
"totalAmountCents": 600000,
"totalPaidAmountCents": 0,
"totalDueAmountCents": 0,
"totalRefundedAmountCents": 0,
"voidedAt": "2026-10-24T16:45:00Z",
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": null,
"paymentFields": [],
"source": "alta",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"version": 2,
"fees": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b5",
"invoiceDisplayName": "Кавомашини для мережі кав’ярень",
"description": null,
"units": "1",
"unitAmountCents": 600000,
"amountCents": 600000,
"taxesAmountCents": 0
}
],
"couponsAmountCents": 0,
"discounts": [],
"payments": [],
"createdAt": "2026-10-23T10:30:00Z"
}Поля — як у відповіді Виставити рахунок
Способи оплати
GET /payment-methods
Групи способів оплати та самі способи: спершу активні, за назвою.
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/payment-methods' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/payment-methods', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/payment-methods",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/payment-methods', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"groups": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-000000000046",
"name": "Безготівково",
"version": 1
},
{
"id": "0192f3a1-7c2e-7b4d-9a61-000000000047",
"name": "Готівка",
"version": 1
}
],
"methods": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"name": "Рахунок у банку",
"groupId": "0192f3a1-7c2e-7b4d-9a61-000000000046",
"active": true,
"bankFinanced": false,
"importedFrom": null,
"version": 1
},
{
"id": "0192f3a1-7c2e-7b4d-9a61-000000000049",
"name": "Картка",
"groupId": "0192f3a1-7c2e-7b4d-9a61-000000000046",
"active": true,
"bankFinanced": false,
"importedFrom": null,
"version": 1
},
{
"id": "0192f3a1-7c2e-7b4d-9a61-00000000004a",
"name": "Каса",
"groupId": "0192f3a1-7c2e-7b4d-9a61-000000000047",
"active": true,
"bankFinanced": false,
"importedFrom": null,
"version": 1
}
]
}Поля відповіді
groupsobject[]Вкладені поля: 3
idstring · uuidnamestringversioninteger≥ 1
methodsobject[]Вкладені поля: 7
activebooleanbankFinancedbooleangroupIdstring · uuid | nullidstring · uuidimportedFromstring | nullnamestringversioninteger≥ 1
Виправити оплату
PATCH /payments/{paymentId}
Дата надходження, спосіб оплати й коментар оплати, внесеної в Alta. З version зміна пройде, лише якщо оплату не змінили після вашого читання (інакше 409). Імпортована — лише для читання.
Параметри шляху
paymentIdstring · uuid обов’язково
Тіло запиту
commentstring | nullдовжина ≤ 1000
methodIdstring · uuid | nullpaidAtstring · date-timepaymentFieldsobject[]кількість ≤ 100
Вкладені поля: 2
fieldIdstring · uuid обов’язковоvaluestring | boolean | string[] · uuid | object | null обов’язковоВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstring обов’язководовжина ≤ 40
currencystring обов’язководовжина ≤ 3
Варіант 5 · object
citystring | nullдовжина ≤ 200
countrystring | nullдовжина ≤ 200
linestring | nullдовжина ≤ 600
postcodestring | nullдовжина ≤ 40
versioninteger≥ 1
Приклад запиту
curl -X PATCH 'https://your-company.altahub.ai/api/v1/payments/{paymentId}' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000049"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/payments/{paymentId}', {
method: 'PATCH',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
methodId: '0192f3a1-7c2e-7b4d-9a61-000000000049',
}),
});
const data = await response.json();import requests
response = requests.patch(
"https://your-company.altahub.ai/api/v1/payments/{paymentId}",
headers={"Authorization": "Bearer alta_…"},
json={
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000049",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PATCH', 'https://your-company.altahub.ai/api/v1/payments/{paymentId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'methodId' => '0192f3a1-7c2e-7b4d-9a61-000000000049',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b1",
"dealId": "0192f3a1-7c2e-7b4d-9a61-000000000014",
"billingEntityCode": "main",
"number": "KAV-202610-001",
"invoiceType": "one_off",
"status": "finalized",
"paymentStatus": "succeeded",
"paymentOverdue": false,
"issuingDate": "2026-10-23",
"paymentDueDate": "2026-10-23",
"netPaymentTerm": 0,
"currency": "UAH",
"feesAmountCents": 600000,
"taxesAmountCents": 0,
"totalAmountCents": 600000,
"totalPaidAmountCents": 600000,
"totalDueAmountCents": 0,
"totalRefundedAmountCents": 0,
"voidedAt": null,
"method": "Картка",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000049",
"comment": "Передоплата 50%",
"paymentFields": [],
"source": "alta",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"version": 2,
"fees": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b4",
"invoiceDisplayName": "Кавомашини для мережі кав’ярень",
"description": null,
"units": "1",
"unitAmountCents": 600000,
"amountCents": 600000,
"taxesAmountCents": 0
}
],
"couponsAmountCents": 0,
"discounts": [],
"payments": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b3",
"paymentType": "manual",
"paymentStatus": "succeeded",
"amountCents": 600000,
"currency": "UAH",
"paidAt": "2026-10-23T10:30:00Z",
"reference": "deal:1042",
"orderReference": null,
"method": "Картка",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000049",
"comment": "Передоплата 50%",
"paymentFields": [],
"canceledAt": null,
"cancelReason": null,
"refundableAmountCents": 600000,
"refunds": [],
"source": "alta",
"version": 2,
"createdAt": "2026-10-23T10:30:00Z"
}
],
"createdAt": "2026-10-23T10:30:00Z"
}Поля — як у відповіді Виставити рахунок
Скасувати помилкову оплату
POST /payments/{paymentId}/cancel
Ручну оплату, внесену помилково, скасовують із причиною: вона лишається як failed, а рахунок знову чекає оплати. Оплату з поверненнями чи імпортовану не скасовують (409).
Параметри шляху
paymentIdstring · uuid обов’язково
Тіло запиту
reasonstring обов’язководовжина 1–500 · шаблон
\S
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/payments/{paymentId}/cancel' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"reason": "Повернення за одну позицію"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/payments/{paymentId}/cancel', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
reason: 'Повернення за одну позицію',
}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/payments/{paymentId}/cancel",
headers={"Authorization": "Bearer alta_…"},
json={
"reason": "Повернення за одну позицію",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/payments/{paymentId}/cancel', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'reason' => 'Повернення за одну позицію',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b1",
"dealId": "0192f3a1-7c2e-7b4d-9a61-000000000014",
"billingEntityCode": "main",
"number": "KAV-202610-001",
"invoiceType": "one_off",
"status": "finalized",
"paymentStatus": "pending",
"paymentOverdue": false,
"issuingDate": "2026-10-23",
"paymentDueDate": "2026-10-23",
"netPaymentTerm": 0,
"currency": "UAH",
"feesAmountCents": 600000,
"taxesAmountCents": 0,
"totalAmountCents": 600000,
"totalPaidAmountCents": 0,
"totalDueAmountCents": 600000,
"totalRefundedAmountCents": 0,
"voidedAt": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"source": "alta",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"version": 2,
"fees": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b4",
"invoiceDisplayName": "Кавомашини для мережі кав’ярень",
"description": null,
"units": "1",
"unitAmountCents": 600000,
"amountCents": 600000,
"taxesAmountCents": 0
}
],
"couponsAmountCents": 0,
"discounts": [],
"payments": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b3",
"paymentType": "manual",
"paymentStatus": "failed",
"amountCents": 600000,
"currency": "UAH",
"paidAt": "2026-10-23T10:30:00Z",
"reference": "deal:1042",
"orderReference": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"canceledAt": "2026-10-24T16:45:00Z",
"cancelReason": "Повернення за одну позицію",
"refundableAmountCents": 0,
"refunds": [],
"source": "alta",
"version": 2,
"createdAt": "2026-10-23T10:30:00Z"
}
],
"createdAt": "2026-10-23T10:30:00Z"
}Поля — як у відповіді Виставити рахунок
Зарахувати оплату
PUT /payments/{paymentId}/credit
Кому зараховано оплату («Зараховано» під оплатою в угоді): за ним аналітика рахує продажі співробітників. Без цього оплату зараховано відповідальному угоди на момент оплати; якщо відповідального тоді не було — першому, кого призначать після, а доти нікому (pending). Так зовнішня система, яка записала оплату, зараховує її тому, хто продав. paymentId — id оплати в payments рахунку (відповідь «Виставити рахунок», «Сплатити рахунок» або «Рахунки угоди»), а не paymentId самого рахунку. member — співробітник: memberId — його id зі «Співробітників» (звільнений теж: продаж лишається його); team — група без людини: teamId з «Груп співробітників»; automatic — знову автоматично, і тоді у відповіді credit: null, доки Alta не зарахує оплату заново. Зараховане вручну лишається, доки його не змінять або не повернуть automatic. Доки зараховане ніхто не змінював, той самий запит ще раз нічого не змінює, тому повтор після втраченої відповіді безпечний; але умови за версією немає, і пізній повтор перепише те, що після вас виправив інший. Зміна — рядок історії угоди від імені автора ключа. Потрібен ключ з правом запису і право «Зарахування оплат» у ролі автора ключа (за замовчуванням воно є у власника й адміністратора), інакше — 403 FORBIDDEN; оплата угоди, яку автор ключа не бачить, — 404, як неіснуюча. Оплату не сплачено або скасовано — 409 payment_not_paid; угода в кошику — 409.
Параметри шляху
paymentIdstring · uuid обов’язково
Тіло запиту
creditobject обов’язковоВаріант 1 · object
kindstring обов’язковоЗначення:
membermemberIdstring · uuid обов’язково
Варіант 2 · object
kindstring обов’язковоЗначення:
teamteamIdstring · uuid обов’язково
Варіант 3 · object
kindstring обов’язковоЗначення:
automatic
Приклад запиту
curl -X PUT 'https://your-company.altahub.ai/api/v1/payments/{paymentId}/credit' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"credit": {
"kind": "member",
"memberId": "0192f3a1-7c2e-7b4d-9a61-000000000002"
}
}'const response = await fetch('https://your-company.altahub.ai/api/v1/payments/{paymentId}/credit', {
method: 'PUT',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
credit: {
kind: 'member',
memberId: '0192f3a1-7c2e-7b4d-9a61-000000000002',
},
}),
});
const data = await response.json();import requests
response = requests.put(
"https://your-company.altahub.ai/api/v1/payments/{paymentId}/credit",
headers={"Authorization": "Bearer alta_…"},
json={
"credit": {
"kind": "member",
"memberId": "0192f3a1-7c2e-7b4d-9a61-000000000002",
},
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://your-company.altahub.ai/api/v1/payments/{paymentId}/credit', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'credit' => [
'kind' => 'member',
'memberId' => '0192f3a1-7c2e-7b4d-9a61-000000000002',
],
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"paymentId": "0192f3a1-7c2e-7b4d-9a61-0000000000b3",
"invoiceId": "0192f3a1-7c2e-7b4d-9a61-0000000000b1",
"credit": {
"kind": "member",
"member": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"team": {
"id": "0192f3a1-7c2e-7b4d-9a61-00000000005c",
"name": "Київ"
}
},
"manual": true
}Поля відповіді
creditobject | nullВаріант 1 · object
kindstringЗначення:
membermemberobjectВкладені поля: 2
idstring · uuidnamestring
teamobject | nullВкладені поля: 2
idstring · uuidnamestring | null
Варіант 2 · object
kindstringЗначення:
teamteamobjectВкладені поля: 2
idstring · uuidnamestring | null
Варіант 3 · object
kindstringЗначення:
pending
invoiceIdstring · uuid | nullmanualbooleanpaymentIdstring · uuid | null
Оформити повернення
POST /payments/{paymentId}/refunds
Сума в копійках — не більша за залишок до повернення (refundableAmountCents), дата — між днем оплати та сьогодні, причина. Потрібне право на повернення; idempotencyKey робить повтор безпечним. orderReference каже: це повернення того самого замовлення у платіжному сервісі (409 order_reference_mismatch, коли оплата не цього замовлення). Хто швидший, той і записує: якщо сервіс уже повідомив про цю суму, відповідь 201 і нічого нового, а якщо ваш запит випередив наступне часткове повернення, його запише сам сервіс, і підсумок завжди дорівнює тому, що він повідомив. Приклад: сервіс повідомив про 300 грн, ви надсилаєте ті самі 300 грн — повернень лишається 300 грн. Без orderReference це звичайне повернення, наприклад готівкою.
Параметри шляху
paymentIdstring · uuid обов’язково
Тіло запиту
amountCentsinteger обов’язково1–9007199254740991
idempotencyKeystring обов’язковошаблон
^[\x21-\x7e]{1,255}$orderReferencestringдовжина 1–200 · шаблон
^(?=.*\S)[^\u0000-\u001f\u007f-\u009f]+$reasonstring | nullдовжина ≤ 1000
refundedAtstring · date-time
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/payments/{paymentId}/refunds' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"amountCents": 100000,
"refundedAt": "2026-10-24T14:00:00Z",
"reason": "Повернення за одну позицію",
"orderReference": "ORDER-20431",
"idempotencyKey": "6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/payments/{paymentId}/refunds', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
amountCents: 100000,
refundedAt: '2026-10-24T14:00:00Z',
reason: 'Повернення за одну позицію',
orderReference: 'ORDER-20431',
idempotencyKey: '6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07',
}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/payments/{paymentId}/refunds",
headers={"Authorization": "Bearer alta_…"},
json={
"amountCents": 100000,
"refundedAt": "2026-10-24T14:00:00Z",
"reason": "Повернення за одну позицію",
"orderReference": "ORDER-20431",
"idempotencyKey": "6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/payments/{paymentId}/refunds', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'amountCents' => 100000,
'refundedAt' => '2026-10-24T14:00:00Z',
'reason' => 'Повернення за одну позицію',
'orderReference' => 'ORDER-20431',
'idempotencyKey' => '6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 201
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b1",
"dealId": "0192f3a1-7c2e-7b4d-9a61-000000000014",
"billingEntityCode": "main",
"number": "KAV-202610-001",
"invoiceType": "one_off",
"status": "finalized",
"paymentStatus": "succeeded",
"paymentOverdue": false,
"issuingDate": "2026-10-23",
"paymentDueDate": "2026-10-23",
"netPaymentTerm": 0,
"currency": "UAH",
"feesAmountCents": 600000,
"taxesAmountCents": 0,
"totalAmountCents": 600000,
"totalPaidAmountCents": 600000,
"totalDueAmountCents": 0,
"totalRefundedAmountCents": 100000,
"voidedAt": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"source": "alta",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"version": 1,
"fees": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b4",
"invoiceDisplayName": "Кавомашини для мережі кав’ярень",
"description": null,
"units": "1",
"unitAmountCents": 600000,
"amountCents": 600000,
"taxesAmountCents": 0
}
],
"couponsAmountCents": 0,
"discounts": [],
"payments": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b3",
"paymentType": "manual",
"paymentStatus": "succeeded",
"amountCents": 600000,
"currency": "UAH",
"paidAt": "2026-10-23T10:30:00Z",
"reference": "deal:1042",
"orderReference": null,
"method": "Рахунок у банку",
"methodId": "0192f3a1-7c2e-7b4d-9a61-000000000048",
"comment": "Передоплата 50%",
"paymentFields": [],
"canceledAt": null,
"cancelReason": null,
"refundableAmountCents": 500000,
"refunds": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-0000000000b6",
"amountCents": 100000,
"status": "succeeded",
"refundedAt": "2026-10-24T14:00:00Z",
"reason": "Повернення за одну позицію",
"createdBy": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000001",
"name": "Андрій Шевченко"
},
"createdAt": "2026-10-24T14:00:00Z"
}
],
"source": "alta",
"version": 1,
"createdAt": "2026-10-23T10:30:00Z"
}
],
"createdAt": "2026-10-23T10:30:00Z"
}Поля — як у відповіді Виставити рахунок