Ir al contenido

API de consola: admin-finance

Esta página se genera a partir de server/api/openapi.yaml. Su contenido está en inglés; no la edites a mano.

Orders, refunds, ledger, reconciliation, redeem codes, plans, affiliate settings. Handlers: internal/admin/finance.

List payment orders

operationId adminListOrders · auth: adminSession

Parameter In Type Required Description
org_id query string<uuid> no
provider query PaymentProvider no
status query OrderStatus no needs_review lists every order in review, including credited orders holding money after a payment-method mismatch (their status is paid or later, review_reason is set).
purpose query OrderPurpose no
cursor query string no Opaque cursor from a previous page’s next_cursor.
limit query integer<int32> no (minimum: 1, maximum: 200, default: 50)
Status Meaning Body
200 OK application/json AdminOrderPage
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminOrderPage

  • data (array of AdminOrder, required)
    • id (string, required)
    • method_mismatch (string, required) — The first payment-method / asset mismatch seen on the order (e.g. asset=BTC, pay_method=2, unclassified); empty when none. Once set nothing more is credited automatically on the order, only a review resolution credits.
    • bonus_ppm (integer, required) — Crypto top-up bonus rate stored when the order was created (ppm); 0 = none.
    • bonus_nano (string, required, pattern: ”^[0-9]+$”) — Bonus credits granted for the order so far, a separate promo grant (source promo, source id topup_bonus:<order id>:…), not part of credited_cents. (Nano-USD, integer string.)
    • provider (PaymentProvider, required)
    • purpose (OrderPurpose, required)
    • status (OrderStatus, required) — rejected: an operator rejected the review; nothing is credited unless the provider later confirms more than rejected_cents.
    • amount_cents (integer, required) — Amount requested, USD cents.
    • confirmed_cents (integer, required) — Cumulative amount confirmed by the provider.
    • credited_cents (integer, required) — Cumulative amount turned into credits.
    • refunded_cents (integer, required)
    • disputed_cents (integer, required)
    • checkout_url (string, required, nullable) — Where to send the payer while the order is pending.
    • receipt_url (string, required, nullable)
    • plan_id (string, required, nullable)
    • expires_at (string, required, nullable)
    • paid_at (string, required, nullable)
    • created_at (string, required)
    • updated_at (string, required)
    • org_id (string, required)
    • user_id (string, required, nullable)
    • review_reason (ReviewReason, required)
    • provider_order_id (string, required)
    • provider_payment_id (string, required)
    • provider_customer_id (string, required)
    • idempotency_key (string, required)
    • subscription_id (string, required, nullable)
    • client_ip (string, required)
    • last_reconciled_at (string, required, nullable)
    • rejected_cents (integer, required) — confirmed_cents at the moment an operator rejected the review; 0 if never rejected.
  • next_cursor (string, required, nullable) — Pass as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

Get a payment order

operationId adminGetOrder · auth: adminSession

Parameter In Type Required Description
order_id path string<uuid> yes
Status Meaning Body
200 OK application/json AdminOrderDetail
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminOrderDetail

  • order (AdminOrder, required) — A payment order with provider references.
    • id (string, required)
    • method_mismatch (string, required) — The first payment-method / asset mismatch seen on the order (e.g. asset=BTC, pay_method=2, unclassified); empty when none. Once set nothing more is credited automatically on the order, only a review resolution credits.
    • bonus_ppm (integer, required) — Crypto top-up bonus rate stored when the order was created (ppm); 0 = none.
    • bonus_nano (string, required, pattern: ”^[0-9]+$”) — Bonus credits granted for the order so far, a separate promo grant (source promo, source id topup_bonus:<order id>:…), not part of credited_cents. (Nano-USD, integer string.)
    • provider (PaymentProvider, required)
    • purpose (OrderPurpose, required)
    • status (OrderStatus, required) — rejected: an operator rejected the review; nothing is credited unless the provider later confirms more than rejected_cents.
    • amount_cents (integer, required) — Amount requested, USD cents.
    • confirmed_cents (integer, required) — Cumulative amount confirmed by the provider.
    • credited_cents (integer, required) — Cumulative amount turned into credits.
    • refunded_cents (integer, required)
    • disputed_cents (integer, required)
    • checkout_url (string, required, nullable) — Where to send the payer while the order is pending.
    • receipt_url (string, required, nullable)
    • plan_id (string, required, nullable)
    • expires_at (string, required, nullable)
    • paid_at (string, required, nullable)
    • created_at (string, required)
    • updated_at (string, required)
    • org_id (string, required)
    • user_id (string, required, nullable)
    • review_reason (ReviewReason, required)
    • provider_order_id (string, required)
    • provider_payment_id (string, required)
    • provider_customer_id (string, required)
    • idempotency_key (string, required)
    • subscription_id (string, required, nullable)
    • client_ip (string, required)
    • last_reconciled_at (string, required, nullable)
    • rejected_cents (integer, required) — confirmed_cents at the moment an operator rejected the review; 0 if never rejected.
  • refundable_nano (string, required, pattern: ”^-?[0-9]+$”) — Unspent refundable credits of the order’s grants. (Nano-USD, integer string.)
  • refundable_cents (integer, required) — The ceiling of a refund request for this order’s provider. With a refund API (supports_api_refund): the smaller of the cash still attributable to the order and its unspent credits converted back at the order’s ratio, 0 for subscription invoices (refund those in the provider dashboard). Without one (Infini): the cash still attributable to the order minus the consumed crypto bonus that the bonus clawback will not book as debt (credited - refunded - disputed - ceil(bonus_held_back); may exceed the unspent credits, the shortfall becomes debt), or for an order never credited (needs_review, rejected) the confirmed amount minus succeeded refunds. 0 when the provider is not configured.
  • bonus_consumed_nano (string, required, pattern: ”^[0-9]+$”) — Crypto top-up bonus of this order already consumed by usage (promo credits burn first). A refund takes the bonus back pro rata; the spent part of that share becomes debt up to bonus_debt_cap_nano per order. 0 for orders without bonus. (Nano-USD, integer string.)
  • bonus_debt_cap_nano (string, required, pattern: ”^[0-9]+$”) — Setting topup.bonus_clawback_debt_cap_nano now in force (0 = spent bonus never becomes debt). (Nano-USD, integer string.)
  • bonus_debt_nano (string, required, pattern: ”^[0-9]+$”) — Debt the bonus clawbacks of this order’s refunds and disputes booked so far and that was not undone (at most bonus_debt_cap_nano). (Nano-USD, integer string.)
  • bonus_held_back_nano (string, required, pattern: ”^[0-9]+$”) — max(bonus_consumed - bonus_debt_cap, 0), the consumed bonus that no debt covers; it lowers refundable_cents of a provider without a refund API. (Nano-USD, integer string.)
  • supports_api_refund (boolean, required) — False for providers without a refund API (Infini): refund in the provider console, then record it with external_ref.

Re-check an order with the provider

operationId adminSyncOrder · auth: adminSession

Parameter In Type Required Description
order_id path string<uuid> yes
Status Meaning Body
200 OK application/json OrderSyncResult
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — OrderSyncResult

  • order (AdminOrder, required) — A payment order with provider references.
    • id (string, required)
    • method_mismatch (string, required) — The first payment-method / asset mismatch seen on the order (e.g. asset=BTC, pay_method=2, unclassified); empty when none. Once set nothing more is credited automatically on the order, only a review resolution credits.
    • bonus_ppm (integer, required) — Crypto top-up bonus rate stored when the order was created (ppm); 0 = none.
    • bonus_nano (string, required, pattern: ”^[0-9]+$”) — Bonus credits granted for the order so far, a separate promo grant (source promo, source id topup_bonus:<order id>:…), not part of credited_cents. (Nano-USD, integer string.)
    • provider (PaymentProvider, required)
    • purpose (OrderPurpose, required)
    • status (OrderStatus, required) — rejected: an operator rejected the review; nothing is credited unless the provider later confirms more than rejected_cents.
    • amount_cents (integer, required) — Amount requested, USD cents.
    • confirmed_cents (integer, required) — Cumulative amount confirmed by the provider.
    • credited_cents (integer, required) — Cumulative amount turned into credits.
    • refunded_cents (integer, required)
    • disputed_cents (integer, required)
    • checkout_url (string, required, nullable) — Where to send the payer while the order is pending.
    • receipt_url (string, required, nullable)
    • plan_id (string, required, nullable)
    • expires_at (string, required, nullable)
    • paid_at (string, required, nullable)
    • created_at (string, required)
    • updated_at (string, required)
    • org_id (string, required)
    • user_id (string, required, nullable)
    • review_reason (ReviewReason, required)
    • provider_order_id (string, required)
    • provider_payment_id (string, required)
    • provider_customer_id (string, required)
    • idempotency_key (string, required)
    • subscription_id (string, required, nullable)
    • client_ip (string, required)
    • last_reconciled_at (string, required, nullable)
    • rejected_cents (integer, required) — confirmed_cents at the moment an operator rejected the review; 0 if never rejected.
  • refund (object, required) — One refund of a payment order.
    • id (string, required)
    • amount_cents (integer, required)
    • status (“pending” | “succeeded” | “failed” | “canceled”, required)
    • provider_refund_id (string, required) — Empty while the refund has not reached the provider.
    • reason (string, required)
    • created_at (string, required)
  • status_changed (boolean, required)
  • credited_cents (integer, required) — Newly credited by this call; 0 on replay.
  • refunded_cents (integer, required) — Newly reversed by this call; 0 on replay and when the reversal was reserved earlier (an API refund reverses the credits before the provider is asked). Not the order’s total: that is order.refunded_cents.
  • disputed_cents (integer, required)

Refund an order

operationId adminRefundOrder · auth: adminSession

At most the order’s refundable_cents. The credits are reversed first, then the provider is asked; the result’s refund.status is pending until the provider confirms (a refund the provider finally refuses gives the credits back). Providers without a refund API need external_ref.

Parameter In Type Required Description
order_id path string<uuid> yes

Request body (required) application/json — RefundRequest

  • idempotency_key (string, required, minLength: 8, maxLength: 64) — Generated when the refund dialog opens. Repeating the call returns the same refund; the same key with a different amount or reason is 409 idempotency_mismatch.
  • amount_cents (integer, required, minimum: 1)
  • reason (string, required, minLength: 3, maxLength: 500)
  • external_ref (string) — Required when the provider has no refund API: reference of the refund made in its console.
Status Meaning Body
200 OK application/json OrderSyncResult
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — OrderSyncResult

  • order (AdminOrder, required) — A payment order with provider references.
    • id (string, required)
    • method_mismatch (string, required) — The first payment-method / asset mismatch seen on the order (e.g. asset=BTC, pay_method=2, unclassified); empty when none. Once set nothing more is credited automatically on the order, only a review resolution credits.
    • bonus_ppm (integer, required) — Crypto top-up bonus rate stored when the order was created (ppm); 0 = none.
    • bonus_nano (string, required, pattern: ”^[0-9]+$”) — Bonus credits granted for the order so far, a separate promo grant (source promo, source id topup_bonus:<order id>:…), not part of credited_cents. (Nano-USD, integer string.)
    • provider (PaymentProvider, required)
    • purpose (OrderPurpose, required)
    • status (OrderStatus, required) — rejected: an operator rejected the review; nothing is credited unless the provider later confirms more than rejected_cents.
    • amount_cents (integer, required) — Amount requested, USD cents.
    • confirmed_cents (integer, required) — Cumulative amount confirmed by the provider.
    • credited_cents (integer, required) — Cumulative amount turned into credits.
    • refunded_cents (integer, required)
    • disputed_cents (integer, required)
    • checkout_url (string, required, nullable) — Where to send the payer while the order is pending.
    • receipt_url (string, required, nullable)
    • plan_id (string, required, nullable)
    • expires_at (string, required, nullable)
    • paid_at (string, required, nullable)
    • created_at (string, required)
    • updated_at (string, required)
    • org_id (string, required)
    • user_id (string, required, nullable)
    • review_reason (ReviewReason, required)
    • provider_order_id (string, required)
    • provider_payment_id (string, required)
    • provider_customer_id (string, required)
    • idempotency_key (string, required)
    • subscription_id (string, required, nullable)
    • client_ip (string, required)
    • last_reconciled_at (string, required, nullable)
    • rejected_cents (integer, required) — confirmed_cents at the moment an operator rejected the review; 0 if never rejected.
  • refund (object, required) — One refund of a payment order.
    • id (string, required)
    • amount_cents (integer, required)
    • status (“pending” | “succeeded” | “failed” | “canceled”, required)
    • provider_refund_id (string, required) — Empty while the refund has not reached the provider.
    • reason (string, required)
    • created_at (string, required)
  • status_changed (boolean, required)
  • credited_cents (integer, required) — Newly credited by this call; 0 on replay.
  • refunded_cents (integer, required) — Newly reversed by this call; 0 on replay and when the reversal was reserved earlier (an API refund reverses the credits before the provider is asked). Not the order’s total: that is order.refunded_cents.
  • disputed_cents (integer, required)

Resolve an order in review

operationId adminResolveOrderReview · auth: adminSession

For an order in needs_review, or a credited order holding money after a payment-method mismatch (review_reason set, status paid or later). approve credits the held money (an uncredited order becomes paid, a credited one keeps its status); the bonus follows the action (see ReviewRequest). reject moves an uncredited order to rejected and takes a credited one out of the review; either way later money is credited only if the provider confirms more than the amount rejected (and, after a payment-method mismatch, only through another review).

Parameter In Type Required Description
order_id path string<uuid> yes

Request body (required) application/json — ReviewRequest

  • action (“approve” | “approve_with_bonus” | “approve_without_bonus” | “reject”, required) — approve credits the money held (confirmed minus credited, minus refunds made while uncredited and an earlier rejection of a credited order); the crypto bonus on it is granted except for review_reason payment_method_mismatch. approve_with_bonus / approve_without_bonus choose explicitly. reject records the confirmed amount as rejected_cents; an order never credited moves to rejected, a credited one keeps its status and leaves the review.
  • note (string)
Status Meaning Body
200 OK application/json AdminOrder
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminOrder

  • id (string, required)
  • method_mismatch (string, required) — The first payment-method / asset mismatch seen on the order (e.g. asset=BTC, pay_method=2, unclassified); empty when none. Once set nothing more is credited automatically on the order, only a review resolution credits.
  • bonus_ppm (integer, required) — Crypto top-up bonus rate stored when the order was created (ppm); 0 = none.
  • bonus_nano (string, required, pattern: ”^[0-9]+$”) — Bonus credits granted for the order so far, a separate promo grant (source promo, source id topup_bonus:<order id>:…), not part of credited_cents. (Nano-USD, integer string.)
  • provider (PaymentProvider, required)
  • purpose (OrderPurpose, required)
  • status (OrderStatus, required) — rejected: an operator rejected the review; nothing is credited unless the provider later confirms more than rejected_cents.
  • amount_cents (integer, required) — Amount requested, USD cents.
  • confirmed_cents (integer, required) — Cumulative amount confirmed by the provider.
  • credited_cents (integer, required) — Cumulative amount turned into credits.
  • refunded_cents (integer, required)
  • disputed_cents (integer, required)
  • checkout_url (string, required, nullable) — Where to send the payer while the order is pending.
  • receipt_url (string, required, nullable)
  • plan_id (string, required, nullable)
  • expires_at (string, required, nullable)
  • paid_at (string, required, nullable)
  • created_at (string, required)
  • updated_at (string, required)
  • org_id (string, required)
  • user_id (string, required, nullable)
  • review_reason (ReviewReason, required)
  • provider_order_id (string, required)
  • provider_payment_id (string, required)
  • provider_customer_id (string, required)
  • idempotency_key (string, required)
  • subscription_id (string, required, nullable)
  • client_ip (string, required)
  • last_reconciled_at (string, required, nullable)
  • rejected_cents (integer, required) — confirmed_cents at the moment an operator rejected the review; 0 if never rejected.

List stored webhook events

operationId adminListWebhookEvents · auth: adminSession

Parameter In Type Required Description
provider query PaymentProvider no
status query “pending” \ “processed” \ “ignored” \
cursor query string no Opaque cursor from a previous page’s next_cursor.
limit query integer<int32> no (minimum: 1, maximum: 200, default: 50)
Status Meaning Body
200 OK application/json WebhookEventPage
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — WebhookEventPage

  • data (array of WebhookEvent, required)
    • id (string, required)
    • provider (PaymentProvider, required)
    • event_id (string, required)
    • event_type (string, required)
    • status (“pending” | “processed” | “ignored” | “failed” | “dead”, required)
    • attempts (integer, required)
    • next_attempt_at (string, required)
    • last_error (string, required)
    • order_id (string, required, nullable)
    • received_at (string, required)
    • processed_at (string, required, nullable)
  • next_cursor (string, required, nullable) — Pass as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

POST /api/v1/admin/webhook-events/{event_id}/retry

Sección titulada «POST /api/v1/admin/webhook-events/{event_id}/retry»

Queue a failed or dead event again

operationId adminRetryWebhookEvent · auth: adminSession

Parameter In Type Required Description
event_id path string<uuid> yes
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error

List ledger transactions

operationId adminListLedgerTxns · auth: adminSession

Parameter In Type Required Description
org_id query string<uuid> no
kind query LedgerTxnKind no
ref_type query string no
ref_id query string no
from query string<date-time> no Inclusive lower bound.
to query string<date-time> no Exclusive upper bound.
cursor query string no Opaque cursor from a previous page’s next_cursor.
limit query integer<int32> no (minimum: 1, maximum: 200, default: 50)
Status Meaning Body
200 OK application/json LedgerTxnPage
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — LedgerTxnPage

  • data (array of LedgerTxn, required)
    • id (string, required)
    • kind (LedgerTxnKind, required)
    • ref_type (string, required)
    • ref_id (string, required)
    • org_id (string, required, nullable)
    • memo (string, required)
    • metadata (object, required)
    • created_by (string, required, nullable)
    • created_at (string, required)
    • legs (array of LedgerLeg, required)
      • txn_id (string, required)
      • leg_no (integer, required) — Position of the leg in its transaction; (txn_id, leg_no) is the leg’s key and the page order.
      • account (string, required)
      • org_id (string, required, nullable)
      • grant_id (string, required, nullable)
      • amount_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
      • created_at (string, required)
  • next_cursor (string, required, nullable) — Pass as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

Get a ledger transaction with its legs

operationId adminGetLedgerTxn · auth: adminSession

Parameter In Type Required Description
txn_id path string<uuid> yes
Status Meaning Body
200 OK application/json LedgerTxn
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — LedgerTxn

  • id (string, required)
  • kind (LedgerTxnKind, required)
  • ref_type (string, required)
  • ref_id (string, required)
  • org_id (string, required, nullable)
  • memo (string, required)
  • metadata (object, required)
  • created_by (string, required, nullable)
  • created_at (string, required)
  • legs (array of LedgerLeg, required)
    • txn_id (string, required)
    • leg_no (integer, required) — Position of the leg in its transaction; (txn_id, leg_no) is the leg’s key and the page order.
    • account (string, required)
    • org_id (string, required, nullable)
    • grant_id (string, required, nullable)
    • amount_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • created_at (string, required)

List ledger legs

operationId adminListLedgerLegs · auth: adminSession

Parameter In Type Required Description
account query string no
org_id query string<uuid> no
grant_id query string<uuid> no
from query string<date-time> no Inclusive lower bound.
to query string<date-time> no Exclusive upper bound.
cursor query string no Opaque cursor from a previous page’s next_cursor.
limit query integer<int32> no (minimum: 1, maximum: 200, default: 50)
Status Meaning Body
200 OK application/json LedgerLegPage
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — LedgerLegPage

  • data (array of LedgerLeg, required)
    • txn_id (string, required)
    • leg_no (integer, required) — Position of the leg in its transaction; (txn_id, leg_no) is the leg’s key and the page order.
    • account (string, required)
    • org_id (string, required, nullable)
    • grant_id (string, required, nullable)
    • amount_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • created_at (string, required)
  • next_cursor (string, required, nullable) — Pass as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

Invariant report: state of the ledger checks

operationId adminGetInvariantStatus · auth: adminSession

Status Meaning Body
200 OK application/json InvariantStatus
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — InvariantStatus

  • open_findings (integer, required)
  • by_check (array of InvariantCheckCount, required)
    • check (LedgerCheck, required)
    • open (integer, required)
  • frozen_orgs (integer, required) — Organisations with ledger_frozen set.
  • last_incremental_at (string, required, nullable)
  • last_full_at (string, required, nullable)

Run the ledger checker now

operationId adminRunInvariantCheck · auth: adminSession

Request body (required) application/json — RunInvariantCheckRequest

  • full (boolean, required) — true = verify everything; false = since the previous run.
Status Meaning Body
200 OK application/json InvariantReport
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — InvariantReport

  • full (boolean, required)
  • checked (integer, required)
  • new_findings (array of LedgerFinding, required)
    • id (string, required)
    • check (LedgerCheck, required)
    • org_id (string, required, nullable)
    • ref_id (string, required)
    • expected_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • actual_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • detail (object, required)
    • detected_at (string, required)
    • resolved_at (string, required, nullable)
    • resolution (string, required)
  • open_findings (integer, required)
  • frozen_org_ids (array of string, required)
  • took_ms (integer, required)

List open ledger findings

operationId adminListLedgerFindings · auth: adminSession

Parameter In Type Required Description
cursor query string no Opaque cursor from a previous page’s next_cursor.
limit query integer<int32> no (minimum: 1, maximum: 200, default: 50)
Status Meaning Body
200 OK application/json LedgerFindingPage
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — LedgerFindingPage

  • data (array of LedgerFinding, required)
    • id (string, required)
    • check (LedgerCheck, required)
    • org_id (string, required, nullable)
    • ref_id (string, required)
    • expected_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • actual_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • detail (object, required)
    • detected_at (string, required)
    • resolved_at (string, required, nullable)
    • resolution (string, required)
  • next_cursor (string, required, nullable) — Pass as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

POST /api/v1/admin/ledger/findings/{finding_id}/resolve

Sección titulada «POST /api/v1/admin/ledger/findings/{finding_id}/resolve»

Close a finding with an explanation

operationId adminResolveLedgerFinding · auth: adminSession

Parameter In Type Required Description
finding_id path string<uuid> yes

Request body (required) application/json — ResolveFindingRequest

  • resolution (string, required, minLength: 3, maxLength: 1000)
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error

Reconciliation report

operationId adminGetReconciliation · auth: adminSession

Parameter In Type Required Description
from query string<date-time> yes Inclusive lower bound.
to query string<date-time> yes Exclusive upper bound.
Status Meaning Body
200 OK application/json ReconciliationReport
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — ReconciliationReport

  • from (string, required)
  • to (string, required)
  • generated_at (string, required)
  • accounts (array of AccountBalance, required)
    • account (string, required)
    • debit_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • credit_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • balance_nano (string, required, pattern: ”^-?[0-9]+$”) — debit - credit over the report window. (Nano-USD, integer string.)
  • liability_ledger_nano (string, required, pattern: ”^-?[0-9]+$”) — credit_liability balance over all time. (Nano-USD, integer string.)
  • liability_orgs_nano (string, required, pattern: ”^-?[0-9]+$”) — Sum of org credits. (Nano-USD, integer string.)
  • liability_difference_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
  • usage_cost_nano (string, required, pattern: ”^-?[0-9]+$”) — Sum of usage_records.cost_nano in the window. (Nano-USD, integer string.)
  • usage_revenue_nano (string, required, pattern: ”^-?[0-9]+$”) — Revenue posted by usage transactions in the window. (Nano-USD, integer string.)
  • usage_difference_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
  • providers (array of ProviderReconciliation, required)
    • provider (PaymentProvider, required)
    • orders_credited_cents (integer, required)
    • orders_refunded_cents (integer, required)
    • orders_disputed_cents (integer, required)
    • ledger_cash_nano (string, required, pattern: ”^-?[0-9]+$”) — Net movement of cash_clearing:<provider>. (Nano-USD, integer string.)
    • difference_nano (string, required, pattern: ”^-?[0-9]+$”) — Zero when books and orders agree. (Nano-USD, integer string.)
    • payment_fees_nano (string, pattern: ”^-?[0-9]+$”) — V3 B1: net provider fees booked against cash_clearing:<provider> in the window (positive = kept by the provider); difference_nano already accounts for them. (Nano-USD, integer string.)
    • open_orders (integer, required)
    • needs_review (integer, required) — Orders in review now - status needs_review, or credited orders holding money after a payment-method mismatch (status kept, review_reason set).
    • failed_webhooks (integer, required)
    • uncredited_cents (integer, required) — Money the provider confirmed that was never credited, all time (confirmed - credited - refunds made while uncredited, per order; subscription and currency_mismatch orders left out). Orders in review, rejected money not yet returned, the held part of credited orders. Not part of difference_nano.

List redeem codes

operationId adminListRedeemCodes · auth: adminSession

Parameter In Type Required Description
batch query string no
cursor query string no Opaque cursor from a previous page’s next_cursor.
limit query integer<int32> no (minimum: 1, maximum: 200, default: 50)
Status Meaning Body
200 OK application/json RedeemCodePage
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — RedeemCodePage

  • data (array of RedeemCode, required)
    • id (string, required)
    • code (string, required)
    • batch (string, required)
    • credit_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • grant_expires_days (integer, required, nullable) — Null = granted credit never expires.
    • max_redemptions (integer, required)
    • redeemed_count (integer, required)
    • active (boolean, required)
    • expires_at (string, required, nullable)
    • created_by (string, required, nullable)
    • created_at (string, required)
  • next_cursor (string, required, nullable) — Pass as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

Generate redeem codes

operationId adminCreateRedeemCodes · auth: adminSession

Request body (required) application/json — RedeemBatchRequest

  • batch (string, required)
  • count (integer, required, minimum: 1, maximum: 10000)
  • code (string) — A shared promo code; count must be 1.
  • credit_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
  • grant_expires_days (integer, nullable)
  • max_redemptions (integer, required, minimum: 1)
  • expires_at (string, nullable)
Status Meaning Body
201 OK application/json RedeemCodeList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — RedeemCodeList

  • data (array of RedeemCode, required)
    • id (string, required)
    • code (string, required)
    • batch (string, required)
    • credit_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • grant_expires_days (integer, required, nullable) — Null = granted credit never expires.
    • max_redemptions (integer, required)
    • redeemed_count (integer, required)
    • active (boolean, required)
    • expires_at (string, required, nullable)
    • created_by (string, required, nullable)
    • created_at (string, required)

POST /api/v1/admin/redeem-codes/{code_id}/status

Sección titulada «POST /api/v1/admin/redeem-codes/{code_id}/status»

Enable or disable a code

operationId adminSetRedeemCodeActive · auth: adminSession

Parameter In Type Required Description
code_id path string<uuid> yes

Request body (required) application/json — SetActiveRequest

  • active (boolean, required)
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error

GET /api/v1/admin/redeem-codes/{code_id}/redemptions

Sección titulada «GET /api/v1/admin/redeem-codes/{code_id}/redemptions»

Who redeemed a code

operationId adminListRedemptions · auth: adminSession

Parameter In Type Required Description
code_id path string<uuid> yes
Status Meaning Body
200 OK application/json AdminRedemptionList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminRedemptionList

  • data (array of AdminRedemption, required)
    • id (string, required)
    • code_id (string, required)
    • org_id (string, required)
    • credit_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
    • grant_id (string, required)
    • created_at (string, required)

List subscription plans, archived included

operationId adminListPlans · auth: adminSession

Status Meaning Body
200 OK application/json AdminPlanList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminPlanList

  • data (array of AdminPlan, required)
    • id (string, required)
    • code (string, required)
    • name (string, required)
    • description (string, required)
    • price_cents (integer, required)
    • interval (PlanInterval, required)
    • credit_nano (string, required, pattern: ”^-?[0-9]+$”) — Credits granted for every paid invoice. (Nano-USD, integer string.)
    • credit_expires (boolean, required) — Granted credits expire at the end of the paid period.
    • features (array of string, required)
    • active (boolean, required)
    • sort_order (integer, required)
    • created_at (string, required)
    • stripe_product_id (string, required)
    • stripe_price_id (string, required)

Create a plan with its Stripe product and price

operationId adminCreatePlan · auth: adminSession

Request body (required) application/json — PlanInput

  • code (string, required)
  • name (string, required)
  • description (string)
  • price_cents (integer, required)
  • interval (PlanInterval, required)
  • credit_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
  • credit_expires (boolean, required)
  • features (array of string)
  • sort_order (integer)
Status Meaning Body
201 OK application/json AdminPlan
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — AdminPlan

  • id (string, required)
  • code (string, required)
  • name (string, required)
  • description (string, required)
  • price_cents (integer, required)
  • interval (PlanInterval, required)
  • credit_nano (string, required, pattern: ”^-?[0-9]+$”) — Credits granted for every paid invoice. (Nano-USD, integer string.)
  • credit_expires (boolean, required) — Granted credits expire at the end of the paid period.
  • features (array of string, required)
  • active (boolean, required)
  • sort_order (integer, required)
  • created_at (string, required)
  • stripe_product_id (string, required)
  • stripe_price_id (string, required)

Edit a plan’s mutable fields

operationId adminUpdatePlan · auth: adminSession

Parameter In Type Required Description
plan_id path string<uuid> yes

Request body (required) application/json — PlanInput

  • code (string, required)
  • name (string, required)
  • description (string)
  • price_cents (integer, required)
  • interval (PlanInterval, required)
  • credit_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
  • credit_expires (boolean, required)
  • features (array of string)
  • sort_order (integer)
Status Meaning Body
200 OK application/json AdminPlan
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminPlan

  • id (string, required)
  • code (string, required)
  • name (string, required)
  • description (string, required)
  • price_cents (integer, required)
  • interval (PlanInterval, required)
  • credit_nano (string, required, pattern: ”^-?[0-9]+$”) — Credits granted for every paid invoice. (Nano-USD, integer string.)
  • credit_expires (boolean, required) — Granted credits expire at the end of the paid period.
  • features (array of string, required)
  • active (boolean, required)
  • sort_order (integer, required)
  • created_at (string, required)
  • stripe_product_id (string, required)
  • stripe_price_id (string, required)

Archive or restore a plan

operationId adminSetPlanActive · auth: adminSession

Parameter In Type Required Description
plan_id path string<uuid> yes

Request body (required) application/json — SetActiveRequest

  • active (boolean, required)
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error

Affiliate programme settings

operationId adminGetAffiliateSettings · auth: adminSession

Status Meaning Body
200 OK application/json AffiliateSettings
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AffiliateSettings

  • enabled (boolean, required)
  • commission_ppm (integer, required, minimum: 0, maximum: 1000000)
  • hold_days (integer, required, minimum: 0)
  • min_convert_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.

Replace affiliate programme settings

operationId adminSetAffiliateSettings · auth: adminSession

Request body (required) application/json — AffiliateSettings

  • enabled (boolean, required)
  • commission_ppm (integer, required, minimum: 0, maximum: 1000000)
  • hold_days (integer, required, minimum: 0)
  • min_convert_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
Status Meaning Body
200 OK application/json AffiliateSettings
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AffiliateSettings

  • enabled (boolean, required)
  • commission_ppm (integer, required, minimum: 0, maximum: 1000000)
  • hold_days (integer, required, minimum: 0)
  • min_convert_nano (NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.

PUT /api/v1/admin/affiliate/codes/{code}/rate

Sección titulada «PUT /api/v1/admin/affiliate/codes/{code}/rate»

Override one code’s commission rate

operationId adminSetAffiliateCodeRate · auth: adminSession

Parameter In Type Required Description
code path string yes

Request body (required) application/json — SetAffiliateCodeRateRequest

  • commission_ppm (integer, required, nullable) — Null restores the programme default.
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error