Оплаты
Оплаты сделок, возвраты и способы оплаты организации.
Плательщики счетов
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"
}Поля — как в ответе Выставить счёт