API лавлах

Gerege Billing API 1.0.0 — api/openapi.yaml-аас build үед үүсгэсэн. Суурь хаяг https://api.billing.gerege.mn. Бүх /v1 зам Authorization: Bearer bk_<prefix>_<secret> шаардана (callback-аас бусад); мөнгө бүхэл минор нэгжээр, нэгжийн үнэ ба тоо хэмжээ аравтын мөрөөр.

Систем

GET/healthzLiveness + DB ping

Хариу 200 · object

status заавалstring
ok

Алдааны код

internal

Tenant

GET/v1/tenantThe caller's tenantread

Хариу 200 · Tenant

id заавалstring (uuid)
slug заавалstring
name заавалstring
currency заавалstring
/^[A-Z]{3}$/
timezone заавалstring
IANA zone; usage day/month buckets use it.
status заавалstring
active · suspended
created_at заавалstring (date-time)

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

POST/v1/api-keysIssue an API keyadmin

Хүсэлтийн бие · APIKeyInput

name заавалstring
урт 1..100
scopes заавалScope[]
1..16 ширхэг

Хариу 201 · object

api_key заавалAPIKey
secret заавалstring
/^bk_[0-9a-f]{12}_.+$/
Full key, shown only here.

Алдааны код

body_too_largeforbiddeninternalinvalid_jsoninvalid_nameinvalid_scopesrate_limitedtenant_suspendedunauthorized

GET/v1/api-keysList API keys (newest first, at most 200)admin

Хариу 200 · object

data заавалAPIKey[] | null
May be null when empty.

Алдааны код

forbiddeninternalrate_limitedtenant_suspendedunauthorized

DELETE/v1/api-keys/{id}Revoke an API keyadmin

Параметр

id заавалpath · string (uuid)

Хариу 204 · —

Биегүй

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

Харилцагч

POST/v1/customersCreate a customeradmin

Хүсэлтийн бие · CustomerInput

external_idstring
урт 1..128
Required on create, unique per tenant; ignored on update.
kindstring
organization · individual; анхдагч "organization"
name заавалstring
урт 1..200
emailstring (email) | null
урт 0..254
tax_idstring | null
урт 0..32
metadataobject
JSON object, at most 8 KiB. Default {}.

Хариу 201 · Customer

id заавалstring (uuid)
external_id заавалstring
урт 0..128
kind заавалstring
organization · individual
name заавалstring
урт 0..200
emailstring
урт 0..254
tax_idstring
урт 0..32
metadata заавалobject
created_at заавалstring (date-time)
updated_at заавалstring (date-time)

Алдааны код

body_too_largecustomer_existsforbiddeninternalinvalid_emailinvalid_external_idinvalid_jsoninvalid_kindinvalid_metadatainvalid_nameinvalid_tax_idrate_limitedtenant_suspendedunauthorized

GET/v1/customersList customers (ascending id)read

Параметр

external_idquery · string
урт 0..128
Exact match (≤ 128).
afterquery · string (uuid)
Keyset cursor: the last id of the previous page (ascending id order). A page shorter than limit is the last.
limitquery · integer
1..200; анхдагч 50

Хариу 200 · object

data заавалCustomer[] | null
May be null when empty.

Алдааны код

forbiddeninternalinvalid_afterinvalid_external_idinvalid_limitrate_limitedtenant_suspendedunauthorized

GET/v1/customers/{id}Get a customerread

Параметр

id заавалpath · string (uuid)

Хариу 200 · Customer

id заавалstring (uuid)
external_id заавалstring
урт 0..128
kind заавалstring
organization · individual
name заавалstring
урт 0..200
emailstring
урт 0..254
tax_idstring
урт 0..32
metadata заавалobject
created_at заавалstring (date-time)
updated_at заавалstring (date-time)

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

PUT/v1/customers/{id}Replace a customer's writable fieldsadmin

Параметр

id заавалpath · string (uuid)

Хүсэлтийн бие · CustomerInput

external_idstring
урт 1..128
Required on create, unique per tenant; ignored on update.
kindstring
organization · individual; анхдагч "organization"
name заавалstring
урт 1..200
emailstring (email) | null
урт 0..254
tax_idstring | null
урт 0..32
metadataobject
JSON object, at most 8 KiB. Default {}.

Хариу 200 · Customer

id заавалstring (uuid)
external_id заавалstring
урт 0..128
kind заавалstring
organization · individual
name заавалstring
урт 0..200
emailstring
урт 0..254
tax_idstring
урт 0..32
metadata заавалobject
created_at заавалstring (date-time)
updated_at заавалstring (date-time)

Алдааны код

body_too_largeforbiddeninternalinvalid_emailinvalid_jsoninvalid_kindinvalid_metadatainvalid_nameinvalid_tax_idnot_foundrate_limitedtenant_suspendedunauthorized

Тоолуур, event, usage

POST/v1/eventsIngest a batch of usage eventsevents:write

Хүсэлтийн бие · object

events заавалEventInput[]
1..500 ширхэг

Хариу 200 · object

results заавалEventResult[]

Алдааны код

body_too_largeforbiddeninternalinvalid_eventsinvalid_jsonrate_limitedtenant_suspendedunauthorized

POST/v1/metersCreate a meteradmin

Хүсэлтийн бие · MeterInput

code заавалstring
/^[a-z0-9][a-z0-9_.:-]{0,63}$/
Unique among active meters.
name заавалstring
урт 1..200
event_type заавалstring
/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/
aggregation заавалstring
count · sum · max · unique_count
propertystring | null
/^[A-Za-z0-9_][A-Za-z0-9_.:-]{0,63}$/
filtersobject
property → required string value; at most 2 KiB encoded.

Хариу 201 · Meter

id заавалstring (uuid)
code заавалstring
name заавалstring
event_type заавалstring
aggregation заавалstring
count · sum · max · unique_count
propertystring
filters заавалobject
status заавалstring
active · archived
created_at заавалstring (date-time)
archived_atstring (date-time)

Алдааны код

body_too_largeforbiddeninternalinvalid_aggregationinvalid_codeinvalid_event_typeinvalid_filtersinvalid_jsoninvalid_nameinvalid_propertymeter_existsrate_limitedtenant_suspendedunauthorized

GET/v1/metersList meters (ascending id)admin

Параметр

statusquery · string
active · archived
afterquery · string (uuid)
Keyset cursor: the last id of the previous page (ascending id order). A page shorter than limit is the last.
limitquery · integer
1..200; анхдагч 50

Хариу 200 · object

data заавалMeter[] | null
May be null when empty.

Алдааны код

forbiddeninternalinvalid_afterinvalid_limitinvalid_statusrate_limitedtenant_suspendedunauthorized

GET/v1/meters/{id}Get a meteradmin

Параметр

id заавалpath · string (uuid)

Хариу 200 · Meter

id заавалstring (uuid)
code заавалstring
name заавалstring
event_type заавалstring
aggregation заавалstring
count · sum · max · unique_count
propertystring
filters заавалobject
status заавалstring
active · archived
created_at заавалstring (date-time)
archived_atstring (date-time)

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

POST/v1/meters/{id}/archiveArchive a meter (idempotent: an archived meter is returned unchanged)admin

Параметр

id заавалpath · string (uuid)

Хариу 200 · Meter

id заавалstring (uuid)
code заавалstring
name заавалstring
event_type заавалstring
aggregation заавалstring
count · sum · max · unique_count
propertystring
filters заавалobject
status заавалstring
active · archived
created_at заавалstring (date-time)
archived_atstring (date-time)

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

GET/v1/usageAggregate a meter for one customer over [from, to)read

Параметр

customer_id заавалquery · string (uuid)
meter_id заавалquery · string (uuid)
from заавалquery · string (date-time)
RFC 3339, inclusive (on occurred_at).
to заавалquery · string (date-time)
RFC 3339, exclusive; after from, at most 400 days later.
group_byquery · string
none · day · month; анхдагч "none"
Buckets in the tenant timezone.

Хариу 200 · Usage

meter_id заавалstring (uuid)
meter_code заавалstring
aggregation заавалstring
customer_id заавалstring (uuid)
from заавалstring (date-time)
to заавалstring (date-time)
group_by заавалstring
none · day · month
timezone заавалstring
data заавалUsageBucket[]
Buckets without events are omitted; edge buckets are clipped to [from, to).

Алдааны код

forbiddeninternalinvalid_customer_idinvalid_frominvalid_group_byinvalid_meter_idinvalid_tonot_foundrate_limitedtenant_suspendedunauthorized

Төлөвлөгөө, захиалга

POST/v1/plansCreate a plan (immutable)admin

Параметр

Idempotency-Keyheader · string
урт 0..128
Optional (≤ 128). Stores the response in the same transaction; a retry with the same key and request replays it, the same key with a different request is 409 idempotency_key_reused.

Хүсэлтийн бие · PlanInput

code заавалstring
/^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/
name заавалstring
урт 1..200
currencystring
/^[A-Z]{3}$/
Default: the tenant currency.
intervalstring
month; анхдагч "month"
minimum_amount_minorinteger
0..∞; анхдагч 0
charges заавалChargeInput[]
1..32 ширхэг

Хариу 201 · Plan

id заавалstring (uuid)
code заавалstring
name заавалstring
currency заавалstring
interval заавалstring
month
minimum_amount_minor заавалinteger
status заавалstring
active · archived
created_at заавалstring (date-time)
charges заавалCharge[]

Алдааны код

body_too_largeforbiddenidempotency_key_reusedinternalinvalid_chargesinvalid_codeinvalid_currencyinvalid_idempotency_keyinvalid_intervalinvalid_jsoninvalid_meter_idinvalid_minimum_amount_minorinvalid_nameplan_code_existsrate_limitedtenant_suspendedunauthorized

GET/v1/plansList plans (ascending id)read

Параметр

statusquery · string
active · archived
afterquery · string (uuid)
Keyset cursor: the last id of the previous page (ascending id order). A page shorter than limit is the last.
limitquery · integer
1..200; анхдагч 50

Хариу 200 · object

data заавалPlan[]

Алдааны код

forbiddeninternalinvalid_afterinvalid_limitinvalid_statusrate_limitedtenant_suspendedunauthorized

GET/v1/plans/{id}Get a plan with its chargesread

Параметр

id заавалpath · string (uuid)

Хариу 200 · Plan

id заавалstring (uuid)
code заавалstring
name заавалstring
currency заавалstring
interval заавалstring
month
minimum_amount_minor заавалinteger
status заавалstring
active · archived
created_at заавалstring (date-time)
charges заавалCharge[]

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

POST/v1/plans/{id}/archiveArchive a plan (stops new subscriptions; existing keep their snapshot)admin

Параметр

id заавалpath · string (uuid)
Idempotency-Keyheader · string
урт 0..128
Optional (≤ 128). Stores the response in the same transaction; a retry with the same key and request replays it, the same key with a different request is 409 idempotency_key_reused.

Хариу 200 · Plan

id заавалstring (uuid)
code заавалstring
name заавалstring
currency заавалstring
interval заавалstring
month
minimum_amount_minor заавалinteger
status заавалstring
active · archived
created_at заавалstring (date-time)
charges заавалCharge[]

Алдааны код

forbiddenidempotency_key_reusedinternalinvalid_idempotency_keynot_foundrate_limitedtenant_suspendedunauthorized

POST/v1/customers/{id}/subscriptionPut a customer on a planadmin

Параметр

id заавалpath · string (uuid)
Customer id.
Idempotency-Keyheader · string
урт 0..128
Optional (≤ 128). Stores the response in the same transaction; a retry with the same key and request replays it, the same key with a different request is 409 idempotency_key_reused.

Хүсэлтийн бие · SubscribeInput

plan_id заавалstring (uuid)
effective_atstring (date-time)
Default now (server clock). Must not precede the start or end of any earlier subscription of the customer.

Хариу 201 · Subscription

id заавалstring (uuid)
customer_id заавалstring (uuid)
plan_id заавалstring (uuid)
status заавалstring
active · ended
starts_at заавалstring (date-time)
ends_at заавалstring (date-time) | null
snapshot заавалPlanSnapshot
created_at заавалstring (date-time)

Алдааны код

already_subscribedbody_too_largecustomer_not_foundeffective_at_overlapsforbiddenidempotency_key_reusedinternalinvalid_idempotency_keyinvalid_jsoninvalid_plan_idnot_foundplan_archivedrate_limitedsubscription_existstenant_suspendedunauthorized

GET/v1/customers/{id}/subscriptionThe customer's active subscriptionread

Параметр

id заавалpath · string (uuid)
Customer id.

Хариу 200 · Subscription

id заавалstring (uuid)
customer_id заавалstring (uuid)
plan_id заавалstring (uuid)
status заавалstring
active · ended
starts_at заавалstring (date-time)
ends_at заавалstring (date-time) | null
snapshot заавалPlanSnapshot
created_at заавалstring (date-time)

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

DELETE/v1/customers/{id}/subscriptionEnd the customer's active subscription nowadmin

Параметр

id заавалpath · string (uuid)
Customer id.
Idempotency-Keyheader · string
урт 0..128
Optional (≤ 128). Stores the response in the same transaction; a retry with the same key and request replays it, the same key with a different request is 409 idempotency_key_reused.

Хариу 200 · Subscription

id заавалstring (uuid)
customer_id заавалstring (uuid)
plan_id заавалstring (uuid)
status заавалstring
active · ended
starts_at заавалstring (date-time)
ends_at заавалstring (date-time) | null
snapshot заавалPlanSnapshot
created_at заавалstring (date-time)

Алдааны код

customer_not_foundforbiddenidempotency_key_reusedinternalinvalid_idempotency_keynot_foundrate_limitedtenant_suspendedunauthorized

GET/v1/subscriptionsList subscriptions (ascending id)read

Параметр

statusquery · string
active · ended
afterquery · string (uuid)
Keyset cursor: the last id of the previous page (ascending id order). A page shorter than limit is the last.
limitquery · integer
1..200; анхдагч 50

Хариу 200 · object

data заавалSubscription[]

Алдааны код

forbiddeninternalinvalid_afterinvalid_limitinvalid_statusrate_limitedtenant_suspendedunauthorized

Хэтэвч

GET/v1/customers/{id}/walletWallet balanceread

Параметр

id заавалpath · string (uuid)
Customer id.

Хариу 200 · Wallet

customer_id заавалstring (uuid)
currency заавалstring
balance_minor заавалinteger
0 before the first movement.

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

GET/v1/customers/{id}/wallet/transactionsWallet movements, newest firstread

Параметр

id заавалpath · string (uuid)
Customer id.
cursorquery · string
/^[1-9][0-9]*$/
next_cursor of the previous page.
limitquery · integer
1..200; анхдагч 50

Хариу 200 · object

data заавалWalletTransaction[]
next_cursor заавалstring | null
Pass as cursor for the next page; null on the last page.

Алдааны код

forbiddeninternalinvalid_cursorinvalid_limitnot_foundrate_limitedtenant_suspendedunauthorized

POST/v1/customers/{id}/wallet/chargeDebit a customer's walletwallet:charge

Параметр

id заавалpath · string (uuid)
Customer id.
Idempotency-Key заавалheader · string
урт 1..128; /^[!-~]+$/
Required: 1..128 printable ASCII. A retry with the same key and body replays the stored response; the same key with a different body is 422 idempotency_key_reused.

Хүсэлтийн бие · WalletChargeInput

amount_minor заавалinteger
1..1000000000000000
descriptionstring
урт 0..300
referencestring
урт 0..128
Unique per tenant among ledger entries; default: the Idempotency-Key.

Хариу 201 · WalletMovement

entry_id заавалstring (uuid)
customer_id заавалstring (uuid)
kind заавалstring
reference заавалstring
amount_minor заавалinteger
currency заавалstring
balance_minor заавалinteger
Balance after the movement.

Алдааны код

body_too_largeduplicate_referenceforbiddenidempotency_key_requiredidempotency_key_reusedinsufficient_fundsinternalinvalid_amount_minorinvalid_descriptioninvalid_jsoninvalid_referencenot_foundrate_limitedtenant_suspendedunauthorized

POST/v1/customers/{id}/wallet/creditsCredit a customer's wallet (manual top-up, adjustment, promo)admin

Параметр

id заавалpath · string (uuid)
Customer id.
Idempotency-Key заавалheader · string
урт 1..128; /^[!-~]+$/
Required: 1..128 printable ASCII. A retry with the same key and body replays the stored response; the same key with a different body is 422 idempotency_key_reused.

Хүсэлтийн бие · WalletCreditInput

amount_minor заавалinteger
1..1000000000000000
descriptionstring
урт 0..300
reason заавалstring
manual_topup · adjustment · promo

Хариу 201 · WalletMovement

entry_id заавалstring (uuid)
customer_id заавалstring (uuid)
kind заавалstring
reference заавалstring
amount_minor заавалinteger
currency заавалstring
balance_minor заавалinteger
Balance after the movement.

Алдааны код

body_too_largeduplicate_referenceforbiddenidempotency_key_requiredidempotency_key_reusedinternalinvalid_amount_minorinvalid_descriptioninvalid_jsoninvalid_reasonnot_foundrate_limitedtenant_suspendedunauthorized

GET/v1/customers/{id}/wallet/settingsWallet settings (low-balance threshold)read

Параметр

id заавалpath · string (uuid)
Customer id.

Хариу 200 · WalletSettings

customer_id заавалstring (uuid)
low_balance_minor заавалinteger | null
null when never set.
low_notified заавалboolean
wallet.low fired and the balance has not come back up since.

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

PUT/v1/customers/{id}/wallet/settingsSet the low-balance thresholdadmin

Параметр

id заавалpath · string (uuid)
Customer id.

Хүсэлтийн бие · WalletSettingsInput

low_balance_minor заавалinteger
0..1000000000000000

Хариу 200 · WalletSettings

customer_id заавалstring (uuid)
low_balance_minor заавалinteger | null
null when never set.
low_notified заавалboolean
wallet.low fired and the balance has not come back up since.

Алдааны код

body_too_largeforbiddeninternalinvalid_jsoninvalid_low_balance_minornot_foundrate_limitedtenant_suspendedunauthorized

POST/v1/customers/{id}/wallet/topupsStart a QPay top-up of a customer's walletwallet:charge

Параметр

id заавалpath · string (uuid)
Customer id.
Idempotency-Key заавалheader · string
урт 1..128; /^[!-~]+$/
Required: 1..128 printable ASCII. A retry with the same key and body replays the stored response; the same key with a different body is 422 idempotency_key_reused.

Хүсэлтийн бие · WalletTopupInput

amount_minor заавалinteger
1..1000000000000000
descriptionstring
урт 0..255
Shown in the bank app; default "Wallet top-up".

Хариу 201 · WalletTopup

payment_id заавалstring (uuid)
status заавалstring
pending
customer_id заавалstring (uuid)
wallet_account_id заавалstring (uuid)
amount_minor заавалinteger
currency заавалstring
qr_text заавалstring
qr_image заавалstring
Base64 PNG.
short_urlstring
deeplinks заавалobject[]
expires_at заавалstring (date-time)

Алдааны код

body_too_largeforbiddenidempotency_in_progressidempotency_key_requiredidempotency_key_reusedinternalinvalid_amount_minorinvalid_descriptioninvalid_jsonnot_foundprovider_errorprovider_not_configuredrate_limitedtenant_suspendedunauthorized

Webhook

POST/v1/webhook-endpointsRegister a webhook endpointadmin

Хүсэлтийн бие · WebhookEndpointInput

url заавалstring (uri)
урт 0..500
Absolute https URL; no credentials, no localhost/private/loopback address.
descriptionstring
урт 0..200
event_typesstring[]
0..32 ширхэг
Empty = every event type.

Хариу 201 · object

endpoint заавалWebhookEndpoint
secret заавалstring
/^whsec_/
Signing secret, shown only here.

Алдааны код

body_too_largeforbiddeninternalinvalid_descriptioninvalid_event_typesinvalid_jsoninvalid_urlrate_limitedtenant_suspendedunauthorized

GET/v1/webhook-endpointsList endpoints (newest first, at most 200)admin

Хариу 200 · object

data заавалWebhookEndpoint[] | null
May be null when empty.

Алдааны код

forbiddeninternalrate_limitedtenant_suspendedunauthorized

DELETE/v1/webhook-endpoints/{id}Disable an endpointadmin

Параметр

id заавалpath · string (uuid)

Хариу 204 · —

Биегүй

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

POST/v1/webhook-endpoints/{id}/rotate-secretReplace the signing secretadmin

Параметр

id заавалpath · string (uuid)

Хариу 200 · object

secret заавалstring
/^whsec_/

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

GET/v1/webhook-deliveriesList deliveries (newest first)admin

Параметр

statusquery · string
pending · succeeded · failed
event_idquery · string (uuid)
limitquery · integer
1..200; анхдагч 50

Хариу 200 · object

data заавалWebhookDelivery[] | null
May be null when empty.

Алдааны код

forbiddeninternalinvalid_event_idinvalid_limitinvalid_statusrate_limitedtenant_suspendedunauthorized

POST/v1/webhook-deliveries/{id}/retrySchedule another attempt of a finished deliveryadmin

Параметр

id заавалpath · string (uuid)

Хариу 202 · WebhookDelivery

id заавалstring (uuid)
event_id заавалstring (uuid)
event_type заавалstring
endpoint_id заавалstring (uuid)
status заавалstring
pending · succeeded · failed
attempts заавалinteger
next_attempt_at заавалstring (date-time)
last_status_code заавалinteger | null
last_error заавалstring | null
created_at заавалstring (date-time)
updated_at заавалstring (date-time)

Алдааны код

delivery_pendingendpoint_disabledforbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

Интеграц

GET/v1/integrationsList provider integrationsadmin

Хариу 200 · object

data заавалIntegration[]

Алдааны код

forbiddeninternalrate_limitedtenant_suspendedunauthorized

PUT/v1/integrations/{provider}Create or replace a provider integrationadmin

Параметр

provider заавалpath · string
qpay · ebarimt

Хүсэлтийн бие · IntegrationInput

config заавалobject
qpay: {base_url, invoice_code}; ebarimt: {posapi_url, merchant_tin, branch_no, district_code, pos_no?}.
secretobject | null
qpay: {client_id, client_secret} — required the first time, omit to keep. ebarimt: not allowed.
statusstring
active · disabled; анхдагч "active"

Хариу 200 · Integration

provider заавалstring
qpay · ebarimt
config заавалobject
status заавалstring
active · disabled
configured заавалboolean
Whether a secret is stored (secrets are never returned).
updated_at заавалstring (date-time)

Алдааны код

body_too_largeforbiddeninternalinvalid_base_urlinvalid_branch_noinvalid_configinvalid_district_codeinvalid_invoice_codeinvalid_jsoninvalid_merchant_tininvalid_pos_noinvalid_posapi_urlinvalid_secretinvalid_statusnot_foundposapi_unavailablerate_limitedtenant_suspendedunauthorized

DELETE/v1/integrations/{provider}Delete a provider integrationadmin

Параметр

provider заавалpath · string
qpay · ebarimt

Хариу 204 · —

Биегүй

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

invoicing

GET/v1/billing-settingsThe tenant's billing settings (defaults until set)read

Хариу 200 · BillingSettings

vat_mode заавалstring
included · added
included: line amounts are gross; added: VAT on top.
city_tax заавалboolean
НХАТ 2% applies.
payment_terms_days заавалinteger
0..365
ebarimt_classification_codestring | null
/^[0-9]{7}$/
ebarimt_measure_unitstring
урт 0..32

Алдааны код

forbiddeninternalrate_limitedtenant_suspendedunauthorized

PUT/v1/billing-settingsReplace the tenant's billing settingsadmin

Хүсэлтийн бие · BillingSettings

vat_mode заавалstring
included · added
included: line amounts are gross; added: VAT on top.
city_tax заавалboolean
НХАТ 2% applies.
payment_terms_days заавалinteger
0..365
ebarimt_classification_codestring | null
/^[0-9]{7}$/
ebarimt_measure_unitstring
урт 0..32

Хариу 200 · BillingSettings

vat_mode заавалstring
included · added
included: line amounts are gross; added: VAT on top.
city_tax заавалboolean
НХАТ 2% applies.
payment_terms_days заавалinteger
0..365
ebarimt_classification_codestring | null
/^[0-9]{7}$/
ebarimt_measure_unitstring
урт 0..32

Алдааны код

body_too_largeforbiddeninternalinvalid_ebarimt_classification_codeinvalid_ebarimt_measure_unitinvalid_jsoninvalid_payment_terms_daysinvalid_vat_moderate_limitedtenant_suspendedunauthorized

POST/v1/billing-runsRun billing for a periodadmin

Параметр

Idempotency-Key заавалheader · string
урт 1..128; /^[!-~]+$/
Required: 1..128 printable ASCII. A retry with the same key and body replays the stored response; the same key with a different body is 422 idempotency_key_reused.

Хүсэлтийн бие · BillingRunInput

period заавалstring
/^2[0-9]{3}-(0[1-9]|1[0-2])$/

Хариу 200 · BillingRun

period заавалstring
period_start заавалstring (date-time)
period_end заавалstring (date-time)
invoices заавалBillingRunInvoice[]
drafts_removed заавалinteger

Алдааны код

amount_too_largebody_too_largeforbiddenidempotency_key_requiredidempotency_key_reusedinternalinvalid_jsoninvalid_periodperiod_closedperiod_not_startedrate_limitedrequest_in_progresstenant_suspendedunauthorized

GET/v1/billing-periodsBilling periods, newest first (max 120)read

Хариу 200 · object

data заавалBillingPeriod[]

Алдааны код

forbiddeninternalrate_limitedtenant_suspendedunauthorized

POST/v1/billing-periods/{period}/closeRun a period one last time and close itadmin

Параметр

period заавалpath · string
/^2[0-9]{3}-(0[1-9]|1[0-2])$/
Billing month YYYY-MM (tenant timezone).
Idempotency-Key заавалheader · string
урт 1..128; /^[!-~]+$/
Required: 1..128 printable ASCII. A retry with the same key and body replays the stored response; the same key with a different body is 422 idempotency_key_reused.

Хариу 200 · BillingPeriodClose

period заавалBillingPeriod
run заавалBillingRun

Алдааны код

amount_too_largeforbiddenidempotency_key_requiredidempotency_key_reusedinternalinvalid_jsonnot_foundperiod_closedperiod_not_endedperiod_not_startedrate_limitedrequest_in_progresstenant_suspendedunauthorized

GET/v1/invoicesList invoicesread

Параметр

statusquery · string
draft · issued · paid · void
customer_idquery · string (uuid)
cursorquery · string (uuid)
The previous page's next_cursor (alias: after).
afterquery · string (uuid)
Keyset cursor: the last id of the previous page (ascending id order). A page shorter than limit is the last.
limitquery · integer
1..200; анхдагч 50

Хариу 200 · object

data заавалInvoice[]
next_cursorstring (uuid)

Алдааны код

forbiddeninternalinvalid_cursorinvalid_customer_idinvalid_limitinvalid_statusrate_limitedtenant_suspendedunauthorized

GET/v1/invoices/{id}An invoice with its lines, payments and e-barimt receiptread

Параметр

id заавалpath · string (uuid)

Хариу 200 · InvoiceDetail

Биегүй

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

GET/v1/invoices/{id}/pdfPrintable invoice page (HTML, Mongolian labels)read

Параметр

id заавалpath · string (uuid)

Хариу 200 · —

Биегүй

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized

POST/v1/invoices/{id}/issueIssue a draft invoiceadmin

Параметр

id заавалpath · string (uuid)
Idempotency-Key заавалheader · string
урт 1..128; /^[!-~]+$/
Required: 1..128 printable ASCII. A retry with the same key and body replays the stored response; the same key with a different body is 422 idempotency_key_reused.

Хариу 200 · Invoice

id заавалstring (uuid)
number заавалstring | null
<slug>-YYYY-MM-NNNN, allocated at issue.
customer_id заавалstring (uuid)
subscription_id заавалstring (uuid)
period заавалstring
period_start заавалstring (date-time)
period_end заавалstring (date-time)
currency заавалstring
status заавалstring
draft · issued · paid · void
vat_mode заавалstring
included · added
city_tax заавалboolean
subtotal_minor заавалinteger
Net of VAT.
vat_minor заавалinteger
city_tax_minor заавалinteger
total_minor заавалinteger
subtotal + VAT + city tax.
amount_paid_minor заавалinteger
wallet_applied_minor заавалinteger
amount_due_minor заавалinteger
snapshot заавалInvoiceSnapshot
due_atstring | null (date-time)
issued_atstring | null (date-time)
paid_atstring | null (date-time)
voided_atstring | null (date-time)
created_at заавалstring (date-time)
updated_at заавалstring (date-time)

Алдааны код

forbiddenidempotency_key_requiredidempotency_key_reusedinternalinvalid_jsoninvoice_not_draftnot_foundrate_limitedrequest_in_progresstenant_suspendedunauthorized

POST/v1/invoices/{id}/voidVoid a draft or an unpaid issued invoiceadmin

Параметр

id заавалpath · string (uuid)
Idempotency-Key заавалheader · string
урт 1..128; /^[!-~]+$/
Required: 1..128 printable ASCII. A retry with the same key and body replays the stored response; the same key with a different body is 422 idempotency_key_reused.

Хариу 200 · Invoice

id заавалstring (uuid)
number заавалstring | null
<slug>-YYYY-MM-NNNN, allocated at issue.
customer_id заавалstring (uuid)
subscription_id заавалstring (uuid)
period заавалstring
period_start заавалstring (date-time)
period_end заавалstring (date-time)
currency заавалstring
status заавалstring
draft · issued · paid · void
vat_mode заавалstring
included · added
city_tax заавалboolean
subtotal_minor заавалinteger
Net of VAT.
vat_minor заавалinteger
city_tax_minor заавалinteger
total_minor заавалinteger
subtotal + VAT + city tax.
amount_paid_minor заавалinteger
wallet_applied_minor заавалinteger
amount_due_minor заавалinteger
snapshot заавалInvoiceSnapshot
due_atstring | null (date-time)
issued_atstring | null (date-time)
paid_atstring | null (date-time)
voided_atstring | null (date-time)
created_at заавалstring (date-time)
updated_at заавалstring (date-time)

Алдааны код

forbiddenidempotency_key_requiredidempotency_key_reusedinternalinvalid_jsoninvoice_not_voidablenot_foundrate_limitedrequest_in_progresstenant_suspendedunauthorized

POST/v1/invoices/{id}/paymentsOpen a QPay payment for the amount dueadmin

Параметр

id заавалpath · string (uuid)
Idempotency-Key заавалheader · string
урт 1..128; /^[!-~]+$/
Required: 1..128 printable ASCII. A retry with the same key and body replays the stored response; the same key with a different body is 422 idempotency_key_reused.

Хариу 201 · PaymentLink

payment заавалProviderPayment
qr_text заавалstring
qr_image заавалstring
Base64 PNG.
short_urlstring
urls заавалobject[]

Алдааны код

body_too_largeforbiddenidempotency_key_requiredidempotency_key_reusedinternalinvalid_jsoninvoice_not_payablenot_foundprovider_errorqpay_not_configuredrate_limitedrequest_in_progresstenant_suspendedunauthorized

Callback

GET/v1/callbacks/qpay/{payment_id}QPay payment callback (public)

Параметр

payment_id заавалpath · string (uuid)

Хариу 200 · object

status заавалstring
pending · paid · cancelled · expired

Алдааны код

internalnot_configurednot_foundrate_limited

POST/v1/callbacks/qpay/{payment_id}QPay payment callback (public)

Параметр

payment_id заавалpath · string (uuid)

Хариу 200 · object

status заавалstring
pending · paid · cancelled · expired

Алдааны код

internalnot_configurednot_foundrate_limited

payments

GET/v1/payments/{id}Payment statusread

Параметр

id заавалpath · string (uuid)

Хариу 200 · Payment

id заавалstring (uuid)
provider заавалstring
qpay
provider_invoice_idstring
purpose заавалstring
invoice · wallet_topup
target_id заавалstring (uuid)
Invoice id or wallet account id.
customer_id заавалstring (uuid)
amount_minor заавалinteger
currency заавалstring
status заавалstring
pending · paid · cancelled · expired
provider_payment_idstring
paid_atstring (date-time)
created_at заавалstring (date-time)
expires_atstring (date-time)
Only while pending.

Алдааны код

forbiddeninternalnot_foundrate_limitedtenant_suspendedunauthorized