LedgerBee Developer
  • Getting started
  • Conventions
  • Products
  • Advisor firms
  • Configuration
  • API Reference
Information
Accounts
    List accountsgetCreate an accountpostGet an accountgetDelete an accountdeleteUpdate an accountpatch
Advisor Authority Extracts
    Submit authority extract data for an advisor firm's clientspost
Advisor Clients
    List the advisor firm's clientsget
API Key
    Get current API keyget
Authority Extracts
    Submit authority extract datapost
Bank Reconciliations
    Reconcile bank lines against entriespostUndo a bank reconciliationpostCheck what undoing a reconciliation would dopostReconcile a batch of matchespostCheck what reconciling a batch of matches would dopostCheck what reconciling bank lines against entries would dopost
Bank Transactions
    List bank linesgetGet a bank linegetDismiss bank lines from reconciliationpostCheck which bank lines a dismiss would changepostRestore dismissed bank lines to reconciliationpostCheck which bank lines a restore would changepost
Billing Groups
    Form a billing grouppostGet a billing groupgetAdd members to a billing grouppostRemove a member from a billing groupdeleteCheck billing group eligibilitypost
Budgets
    List budgetsgetGet a budgetgetGet the budget vs actuals comparisongetExport a budget's Excel workbookgetOverwrite a budget's figures from an edited workbookpostList a budget's frozen baselinesgetGet a frozen baseline with its snapshot cellsgetList a budget's re-baseline proposalsgetList a budget's scenariosgetResolve a budget's grid under a scenariogetGet the variance report vs a frozen baselinegetGet the runway headlineget
Checkout
    Confirm the checkoutpostQuote a first periodpostIntegration readinessgetMint a checkout sessionpostRehydrate a sessiongetRelease the card hold (edit-after-card)postPoll card statusgetOpen the card windowpostOpen a card window for a live subscriptionpost
Company
    Get company detailsget
Connected app OAuth
    JSON Web Key Set used to verify OAuth access-token signaturesgetRFC 8414 authorization-server metadata for the connected-app OAuth servergetRFC 9728 protected-resource metadata for an MCP resourcegetRFC 9728 protected-resource metadata for an MCP resourcegetOpenID Connect discovery document for the connected-app OAuth serverget
Credit Note Links
    Link a credit note to the invoice it creditspostCheck a credit note’s links and the invoices it can be linked topostDetach a credit note from the invoices it is applied topost
Credit Notes
    List credit notesgetCreate a credit notepostGet a credit notegetGet the delivery status of a credit notegetDownload the credit note PDFgetSend a credit note to the customerpostCredit a whole invoicepost
Customers
    List customersgetCreate a customerpostGet a customergetDelete a customerdeleteUpdate a customerpatchList a customer's contactsgetList a customer's departmentsgetList customer groupsget
Dimensions
    List all dimensionsgetCreate a new dimension categorypostGet a dimensiongetUpdate a dimension categoryputDelete a dimension categorydeleteList distribution keys (paginated)getCreate a distribution keypostGet a distribution keygetList dimension values (paginated)getCreate a new dimension valuepostUpdate a dimension valueputDelete a dimension valuedelete
Discounts
    List discountsgetCreate a discountpostGet a discountgetDelete a discountdeleteUpdate a discountpatchSet a discount's amount in one currencyputRemove a discount's amount in one currencydeleteCheck whether a discount applies to a product for a customer on a daygetAssign a discountpostRemove an assignmentdeleteUpdate an assignmentpatchList a discount's codesgetAdd a code to a discountpostDelete a codedeleteUpdate a codepatchList the discounts that apply to a product for a customer on a daygetCheck a cartpostLook up a discount codeget
Document Templates
    List document templatesget
Document Upload Links
    Upload a file through a minted linkpost
Download Links
    Mint a download link for a document PDFgetDownload a minted linkget
Draft Journal Entries
    Create multiple draft journal entries in batchpostList draft journal entriesgetCreate a draft journal entrypostGet a draft journal entrygetDelete a draft journal entrydeleteBook a draft journal entrypost
Draft Journal Entries (v2)
    Create draft journal entries in batch (v2)postList draft journal entries (v2)getCreate a draft journal entry (v2)postGet a draft journal entry (v2)getDelete a draft journal entry (v2)deleteUpdate a draft journal entry (v2)patchGet attachments for a draft journal entry (v2)getAdd a document to a draft journal entry (v2)postRemove a document from a draft journal entry (v2)deleteBook a draft journal entry (v2)post
Entitlements
    List entitlementsgetCreate an entitlementpostGet an entitlementgetDelete an entitlementdeleteUpdate an entitlementpatch
Invoices
    List invoicesgetCreate a draft invoicepostGet an invoicegetDelete a draft invoicedeleteUpdate an unsent invoicepatchGet the delivery status of an invoicegetDownload the invoice PDFgetSend an invoice to the customerpost
Journal Categories
    List journal categoriesgetCreate a journal categorypostUpdate a journal categoryputDelete a journal categorydelete
Journal Entries
    List journal entriesgetGet a journal entrygetUpdate a journal entry — correct the reference and/or set your external system idpatchGet attachments for a journal entrygetAdd a document to a journal entrypostRemove a document from a journal entrydeletePreview a correction without posting itpostMove postings to different accounts, keeping the document intactpostRebuild the entry a reversal undid, as a draftpostPreview rebuilding the entry a reversal undidpostReverse a posted entry and open a draft to re-enter itpostReverse posted journal entries in batchpostPreview reversing posted journal entries in batchpostReverse a posted journal entrypostPreview reversing a posted journal entrypost
Journal Entries (v2)
    Create a journal entry (v2)postCreate journal entries in batch (v2)post
MCP
    LedgerBee Developer MCP Serverpost
Meters
    List meter subscriptions by IDgetReport usagepostList meter subscriptions by nameget
Open Entries
    List a counterparty’s open entriesget
Order Confirmations
    List order confirmationsgetCreate a draft order confirmationpostGet an order confirmationgetUpdate a draft order confirmationpatchConvert an order confirmation into an invoicepostDownload an order confirmation as PDFgetSend an order confirmationpost
Payment Methods
    List saved payment methods for a customergetCancel a saved card on the payment providerdeleteUnassign a payment method from a customerdeleteGenerate a link for the customer to save a card for future paymentspostSet a saved payment method as the customer defaultput
Portal Plans
    List the full plan cataloguegetGet a plangetResolve the gated pricing catalogue for an identified buyer (partner display)post
Portal SSO
    Get a tenant's SSO signing keys (JWKS)getMint a checkout-vouch token (partner-vouched anonymous checkout)postMint a customer-portal SSO handoff referencepostProvision a customer + grant portal access (partner JIT provisioning)postRevoke (force-refresh) a user's customer-portal sessionspost
Product Groups
    List product groupsgetCreate a product grouppostGet a product groupgetDelete a product groupdeleteUpdate a product grouppatch
Product Prices
    Create a product pricepostGet a product pricegetDelete a product pricedeleteUpdate a product pricepatchActivate a product pricepostArchive a product pricepostDisable a product pricepostSet a price as the product defaultpost
Products
    List productsgetCreate a productpostGet a productgetDelete a productdeleteUpdate a productpatchArchive a productpost
Projects
    List all projectsgetCreate or update a project by external referenceputCreate a projectpostGet a projectgetUpdate a projectputGet project profitgetAdd a subprojectpostUpdate a subprojectputDelete a subprojectdelete
Quotes
    List quotesgetCreate a draft quotepostGet a quotegetUpdate a draft quotepatchConvert a quotepostDownload a quote as PDFgetSend a quotepost
Settlements
    List a counterparty’s settlementsgetSettle open entries against each otherpostGet a settlementgetUndo a settlementpostCheck what undoing a settlement would dopostCheck what settling these entries would dopost
Shipments
    List shipmentsgetCreate a shipment from an orderpostGet a shipmentgetCancel a shipmentpostDispatch a shipmentpost
Stock
    List stock movementsgetList on-hand stockgetOn-hand for one productget
Subscriptions
    List customer subscriptionsgetAssign a subscription to a customerpostGet a customer subscription by its stable idgetUpdate a customer subscriptionpatchAdd an add-on to a customer subscriptionpostAttach existing subscriptions as add-onspostCheck whether subscriptions can become add-onspostChange the products on a customer subscriptionpostRetry a failed card paymentpostList a subscription's pending scheduled changesgetCancel a single pending scheduled changedeleteGet a subscription's unbilled usagegetCancel a customer subscriptionpostList subscription plansgetCreate a subscription planpostArchive a subscription planpost
Suppliers
    List suppliersgetCreate a supplierpostDelete a supplierdeleteList supplier contactsgetList supplier departmentsgetList supplier groupsget
VAT Codes
    List VAT codesgetCreate a VAT codepostGet a VAT codegetDelete a VAT codedeleteUpdate a VAT codepatch
VAT periods
    Record a VAT return filed outside LedgerBeepostPreview recording a VAT return filed outside LedgerBeepostSettle a filed VAT periodpostPreview a VAT period settlementpost
Vendors
    List vendorsgetCreate a vendorpostList vendor contactsgetList vendor departmentsgetList vendor groupsget
Webhook Endpoints
    List webhook endpointsgetCreate a webhook endpointpostRetrieve a webhook endpointgetUpdate a webhook endpointputDelete a webhook endpointdeleteRoll the signing secretpostSend a test eventpost
Schemas
LedgerBee Public API
LedgerBee Public API

Subscriptions

Download schema

Subscription plan and customer subscription management endpoints


List customer subscriptions

GET
https://api.ledgerbee.com/api
/v1/subscriptions
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Retrieves a paginated list of your company's customer subscriptions.

The list can be narrowed by free-text search, subscription statuses, customerId, planId, or your own partnerReferenceId.

Pagination

Subscriptions are listed newest first. Pass each response's nextCursor back as cursor, with the same filters, until hasMore is false. Paging by page is deprecated, and page cannot be sent with cursor (400 PAGINATION_CURSOR_WITH_PAGE). A cursor replayed with other filters is refused with 400 PAGINATION_INVALID_CURSOR.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

List customer subscriptions › query Parameters

cursor
​string

Opaque cursor from the previous response's nextCursor. Returns the rows after it, in the same order. Send the same filters and sort as the request that produced it, and do not send page. The preferred way to page through a list.

page
​number · min: 1 · deprecated

Deprecated: page with cursor instead. Page number (1-indexed). From 2026-12-31, a page past the first of a list with more than 10,000 matching rows is refused.

Default: 1
limit
​number · min: 1 · max: 100

Number of items per page

Example: 25
Default: 25
search
​string

Search by customer name or subscription name

statuses
​string[]

Filter by subscription statuses

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
customerId
​string

Filter by customer ID

planId
​string

Filter by subscription plan ID

partnerReferenceId
​string

Filter to the subscription(s) carrying this exact partner reconciliation reference — the clientReferenceId you passed at embedded-checkout bind time. Use it to recover a missed subscription webhook: resolve our subscription from your own order id.

Example: order_7f3a9c21

List customer subscriptions › Responses

List of customer subscriptions

PublicListCustomerSubscriptionsResponse
​PublicCustomerSubscriptionListItem[] · required

List of customer subscriptions

total
​number · required

Total number of customer subscriptions matching the query

Example: 42
limit
​number · required

Maximum number of items per page

Example: 25
nextCursor
​string | null · required

Cursor for the next page; pass it as cursor. null on the last page, and on every page of a sort that cannot page by cursor — hasMore then says whether another page follows by page number.

Example: eyJ2IjoxLCJmIjoiOWMxZjQyYWIzMTA4ZDc2ZSIsImsiOlsiMjAyNi0wMS0yMCJdfQ
hasMore
​boolean · required

Whether more rows follow this page.

Example: true
page
​number · deprecated

Deprecated: page with nextCursor instead. Current page number (1-indexed).

Example: 1
totalPages
​number · deprecated

Deprecated: page with nextCursor instead. Total number of pages available.

Example: 2
GET/v1/subscriptions
curl https://api.ledgerbee.com/api/v1/subscriptions \ --header 'x-api-key: <api-key>'
Example Responses
{ "data": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "customerNumber": "C001", "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "status": "active", "startDate": "2024-01-01", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "currency": "DKK", "monthlyRevenue": "15000.00", "hasMeteredProducts": false, "partnerReferenceId": "order_7f3a9c21", "billingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionName": "Premium Plan", "addons": [ { "subscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "subscriptionName": "Extra seats" } ], "products": [ { "productId": "0198A0F1-2B33-7D44-8E55-6F778899AABB", "productName": "Bookkeeping Pro license", "productNumber": "1001", "priceId": "0198A0F1-2B33-7D44-8E55-6F778899AACC", "billingPeriodType": "recurring", "pricingModel": "flat_rate", "quantity": 3, "unitPrice": "499.00", "customPrice": "89.99", "description": "Agreed price for 2026" } ] } ], "total": 42, "page": 1, "limit": 25, "totalPages": 2, "nextCursor": "eyJ2IjoxLCJmIjoiOWMxZjQyYWIzMTA4ZDc2ZSIsImsiOlsiMjAyNi0wMS0yMCJdfQ", "hasMore": true }
json
application/json

Assign a subscription to a customer

POST
https://api.ledgerbee.com/api
/v1/subscriptions
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Creates a customer subscription from a plan, starting on startDate.

When billingDirection is omitted, the subscription defaults to in-advance (ADVANCE) billing.

Pass addons to create add-ons together with it: each becomes a subscription of its own, billed on this subscription's invoice inside its section. The response lists them under addons. addons cannot be combined with joinBillingGroupId or formBillingGroupWithSubscriptionId (400 SHARED_VALIDATION_FAILED, details.reason = ADDONS_WITH_BILLING_GROUP_PLACEMENT).

The response includes the subscription's stable id — use it for all subsequent reads, updates, and cancellations; it stays valid across plan replacements and other scheduled changes.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Assign a subscription to a customer › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Assign a subscription to a customer › Request Body

PublicAssignSubscriptionRequest
customerId
​string · required

Customer ID to assign the subscription to

Example: 550e8400-e29b-41d4-a716-446655440000
planId
​string · required

Subscription plan ID

Example: 550e8400-e29b-41d4-a716-446655440000
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
billingCycleAnchor
​string

Billing cycle anchor date (ISO 8601). When the billing cycle should align to. Defaults to startDate if not provided.

Example: 2024-02-01
prorationBehavior
​string · enum

How to handle proration from startDate to billingCycleAnchor

Enum values:
create_prorations
always_invoice
none
Example: none
Default: none
trialDays
​number · min: 0 · max: 365

Trial period in days

Example: 14
billingDirection
​string · enum

Billing direction for this subscription

Enum values:
advance
arrears
Example: advance
customerDepartmentId
​string

Customer department ID for invoice delivery

Example: 550e8400-e29b-41d4-a716-446655440000
departmentContactOverrideId
​string

Contact override ID for department invoice delivery

Example: 550e8400-e29b-41d4-a716-446655440000
​PublicAssignSubscriptionProductOverride[] · maxItems: 200

Optional quantity and price overrides for products in the plan

automaticBilling
​boolean

Whether to enable automatic billing

Example: false
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]
collectViaLeverandorservice
​boolean

Collect each billing cycle via Leverandørservice (Danish direct debit) instead of a card charge. DKK-only. Requires the tenant to hold the Leverandørservice license, a configured creditor number, and a registered mandate for the customer.

Example: false
joinBillingGroupId
​string

Create the subscription straight onto this billing group of the same customer. The group replaces billingCycleAnchor with its own billing date, and the assignment and the join commit together, so a refused join creates no subscription. startDate and prorationBehavior still decide the period up to the group's date. Cannot be combined with formBillingGroupWithSubscriptionId.

Example: 0197A943-2325-7829-B835-B6C71A293065
formBillingGroupWithSubscriptionId
​string

Create the subscription and form a NEW billing group with this existing subscription of the same customer as the lead: the lead's next billing date replaces billingCycleAnchor, and its terms are written onto the new subscription. The assignment and the formation commit together. Cannot be combined with joinBillingGroupId.

Example: 0197A943-2325-7829-B835-B6C71A293065
discountIds
​string[] · maxItems: 20

Discount records the subscription references, in the order they apply, by id. Each bills on every period that starts before its end: a discount that lasts a number of periods ends that many billing periods after the first one billed (after any trial), and one without a duration has no end. Each is checked when attached: it exists, a fixed or per-unit one has an amount in the subscription currency, it combines with the others, and it is not code-only. The subscription takes one use of each discount limit, however many periods it bills. Refusals: DISCOUNT_NOT_FOUND, DISCOUNT_NO_AMOUNT_IN_CURRENCY, DISCOUNT_PER_UNIT_NEEDS_LINE_SCOPE, DISCOUNT_NOT_COMBINABLE, DISCOUNT_REFERENCED_TWICE, DISCOUNT_NOT_APPLICABLE, DISCOUNT_REDEMPTION_LIMIT_REACHED, DISCOUNT_CUSTOMER_REDEMPTION_LIMIT_REACHED, DISCOUNT_DURATION_NEEDS_RECURRING_PRODUCT.

Example: ["0197A943-2325-7829-B835-B6C71A293065"]
​PublicAssignSubscriptionAddon[] · maxItems: 19

Add-ons created together with this subscription. Each becomes a subscription of its own that bills on this subscription’s invoice, inside its section, and ends when this subscription is cancelled. An add-on takes its customer, dates, billing direction and invoice details from this subscription, so it names only its plan and product overrides. The subscription and its add-ons commit together: a refused add-on creates nothing. Cannot be combined with joinBillingGroupId or formBillingGroupWithSubscriptionId (400 SHARED_VALIDATION_FAILED, details.reason = ADDONS_WITH_BILLING_GROUP_PLACEMENT). To add an add-on to an existing subscription, use POST /v1/subscriptions/{id}/addons.

discountCode
​string · maxLength: 64

A discount code the customer gave, matched without regard to case or surrounding spaces. Its discount is attached to this subscription (not to its add-ons) and bills on every period that starts before the discount ends: a discount that lasts N periods ends N billing periods after the first one billed, which with trialDays is the first period after the trial. A code that is unknown, switched off, expired, for another customer or with no use left is refused with its DISCOUNT_* code and nothing is created. The subscription takes one use of the discount and of the code, whatever number of periods it bills.

Example: WELCOME10
paymentMethodId
​string · deprecated

Deprecated and non-functional. Cards are attached by the buyer with their consent (card-save link / portal checkout); any value here is rejected. Field retained only so the request is validated cleanly.

Example: 550e8400-e29b-41d4-a716-446655440000

Assign a subscription to a customer › Responses

Subscription assigned to customer successfully

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
monthlyRevenue
​string · required

What the subscription bills per month today, as a decimal string, in currency, excluding VAT. Every billing interval is converted to one month: a quarter is divided by 3, half a year by 6, a year by 12, and weekly prices are multiplied by 52/12. Plan discounts, interval discounts and recurring surcharges are applied; one-off charges are not included. Add-ons are not included either: each add-on is its own subscription with its own monthlyRevenue, so adding up every subscription counts nothing twice, and the invoice a parent sends carries its own figure plus its add-ons’. Usage-based lines are left out, because their consumption is not known until the period closes: a metered line counts only through a prepaid commitment, or a fee its price charges at zero usage (see hasMeteredProducts, and GET /v1/subscriptions/{id}/usage for the usage recorded so far). A change scheduled for a later date shows from the day it takes effect. During a trial it is the price billing starts at. 0 for a subscription that has not started yet or has ended.

Example: 15000.00
hasMeteredProducts
​boolean · required

Whether any product on the subscription is billed on a meter. When true, monthlyRevenue leaves the metered consumption out; read GET /v1/subscriptions/{id}/usage for the usage recorded so far in the current period.

Example: false
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
addonOfSubscriptionId
​string | null · required

The subscription this one is an add-on of, or null. An add-on bills on its parent’s invoice, inside the parent’s section, and ends when the parent is cancelled.

Example: 0197A943-2325-7829-B835-B6C71A293065
addonOfSubscriptionName
​string | null · required

Current name of the subscription this one is an add-on of, or null when it is not an add-on.

Example: Premium Plan
​PublicSubscriptionAddon[] · required

The add-ons billed on this subscription’s invoice, inside its section. Empty when it has none, and always empty on an add-on — an add-on cannot have add-ons of its own.

​PublicSubscriptionDiscount[] · required

The discount records the subscription references, in the order they apply, each as the record is now with the end date this subscription carries for it. Empty when it references none.

​PublicSubscriptionProduct[] · required

The products the subscription bills today, newest line first. A change scheduled for a later date is listed under GET /v1/subscriptions/{id}/scheduled-changes and appears here once it takes effect. An add-on’s products are on the add-on’s own subscription.

​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601). On an add-on this is its parent’s scheduled churn date: a scheduled cancellation of the parent ends every add-on with it.

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
billingGroupId
​string | null

The billing group this subscription is billed together with others on, or null when it bills on its own. A grouped subscription is billed on the group’s document and charged on the group’s card, so its own paymentMethodId is null and automaticBilling is false. A subscription that merely has other subscriptions billed as part of its own section is not grouped: it reports null and keeps its own card. So does one that IS such a section. A subscription that has joined a group but not yet reached its first shared billing date already reports the group.

Example: 0197A943-2325-7829-B835-B6C71A293065
POST/v1/subscriptions
curl https://api.ledgerbee.com/api/v1/subscriptions \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "customerId": "550e8400-e29b-41d4-a716-446655440000", "planId": "550e8400-e29b-41d4-a716-446655440000", "startDate": "2024-01-01", "endDate": "2025-01-01", "billingCycleAnchor": "2024-02-01", "prorationBehavior": "none", "trialDays": 14, "billingDirection": "advance", "customerDepartmentId": "550e8400-e29b-41d4-a716-446655440000", "departmentContactOverrideId": "550e8400-e29b-41d4-a716-446655440000", "productOverrides": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 25, "customPrice": "149.00", "committedQuantity": 100, "usageCarryoverMode": "reset", "underageMode": "forfeit", "minimumCommittedQuantity": 0, "committedUnitPrice": 8, "discardPreAssignmentUsage": true } ], "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": false, "allowedPaymentProviders": [ "STRIPE" ], "collectViaLeverandorservice": false, "joinBillingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "formBillingGroupWithSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "discountIds": [ "0197A943-2325-7829-B835-B6C71A293065" ], "addons": [ { "planId": "550e8400-e29b-41d4-a716-446655440000", "productOverrides": [], "cadence": "month-1" } ], "discountCode": "WELCOME10" }'
Example Request Body
{ "customerId": "550e8400-e29b-41d4-a716-446655440000", "planId": "550e8400-e29b-41d4-a716-446655440000", "startDate": "2024-01-01", "endDate": "2025-01-01", "billingCycleAnchor": "2024-02-01", "prorationBehavior": "none", "trialDays": 14, "billingDirection": "advance", "customerDepartmentId": "550e8400-e29b-41d4-a716-446655440000", "departmentContactOverrideId": "550e8400-e29b-41d4-a716-446655440000", "productOverrides": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 25, "customPrice": "149.00", "committedQuantity": 100, "usageCarryoverMode": "reset", "underageMode": "forfeit", "minimumCommittedQuantity": 0, "committedUnitPrice": 8, "discardPreAssignmentUsage": true } ], "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": false, "allowedPaymentProviders": [ "STRIPE" ], "collectViaLeverandorservice": false, "joinBillingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "formBillingGroupWithSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "discountIds": [ "0197A943-2325-7829-B835-B6C71A293065" ], "addons": [ { "planId": "550e8400-e29b-41d4-a716-446655440000", "productOverrides": [], "cadence": "month-1" } ], "discountCode": "WELCOME10" }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "monthlyRevenue": "15000.00", "hasMeteredProducts": false, "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ], "partnerReferenceId": "order_7f3a9c21", "billingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionName": "Premium Plan", "addons": [ { "subscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "subscriptionName": "Extra seats", "planId": "550e8400-e29b-41d4-a716-446655440000", "status": "active", "addedOn": "2024-03-10", "effectiveNextBillingDate": "2024-04-01", "monthlyRevenue": "99.99", "currency": "DKK" } ], "discounts": [ { "discountId": "0197A943-2325-7829-B835-B6C71A293065", "name": "Loyalty 10%", "type": "percentage", "scope": "line", "percentagePct": "10", "amountInCurrency": null, "active": true, "endsAt": "2026-12-01", "targetsNoProduct": true } ], "products": [ { "productId": "0198A0F1-2B33-7D44-8E55-6F778899AABB", "productName": "Bookkeeping Pro license", "productNumber": "1001", "priceId": "0198A0F1-2B33-7D44-8E55-6F778899AACC", "billingPeriodType": "recurring", "pricingModel": "flat_rate", "quantity": 3, "unitPrice": "499.00", "customPrice": "89.99", "description": "Agreed price for 2026" } ] }
json
application/json

Get a customer subscription by its stable id

GET
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Returns the current state of the subscription identified by its stable id — the chain head id returned at creation. The id is resolved against the version chain, so it keeps working across plan replacements, billing-direction / cadence changes, and scheduled cancellations; the headline plan fields always reflect the version running today.

addons lists the add-ons billed on this subscription's invoice. On an add-on, addonOfSubscriptionId names its parent, addons is empty, and scheduledChurnDate is the parent's when the parent is scheduled to cancel.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Get a customer subscription by its stable id › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

Get a customer subscription by its stable id › Responses

Customer subscription

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
monthlyRevenue
​string · required

What the subscription bills per month today, as a decimal string, in currency, excluding VAT. Every billing interval is converted to one month: a quarter is divided by 3, half a year by 6, a year by 12, and weekly prices are multiplied by 52/12. Plan discounts, interval discounts and recurring surcharges are applied; one-off charges are not included. Add-ons are not included either: each add-on is its own subscription with its own monthlyRevenue, so adding up every subscription counts nothing twice, and the invoice a parent sends carries its own figure plus its add-ons’. Usage-based lines are left out, because their consumption is not known until the period closes: a metered line counts only through a prepaid commitment, or a fee its price charges at zero usage (see hasMeteredProducts, and GET /v1/subscriptions/{id}/usage for the usage recorded so far). A change scheduled for a later date shows from the day it takes effect. During a trial it is the price billing starts at. 0 for a subscription that has not started yet or has ended.

Example: 15000.00
hasMeteredProducts
​boolean · required

Whether any product on the subscription is billed on a meter. When true, monthlyRevenue leaves the metered consumption out; read GET /v1/subscriptions/{id}/usage for the usage recorded so far in the current period.

Example: false
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
addonOfSubscriptionId
​string | null · required

The subscription this one is an add-on of, or null. An add-on bills on its parent’s invoice, inside the parent’s section, and ends when the parent is cancelled.

Example: 0197A943-2325-7829-B835-B6C71A293065
addonOfSubscriptionName
​string | null · required

Current name of the subscription this one is an add-on of, or null when it is not an add-on.

Example: Premium Plan
​PublicSubscriptionAddon[] · required

The add-ons billed on this subscription’s invoice, inside its section. Empty when it has none, and always empty on an add-on — an add-on cannot have add-ons of its own.

​PublicSubscriptionDiscount[] · required

The discount records the subscription references, in the order they apply, each as the record is now with the end date this subscription carries for it. Empty when it references none.

​PublicSubscriptionProduct[] · required

The products the subscription bills today, newest line first. A change scheduled for a later date is listed under GET /v1/subscriptions/{id}/scheduled-changes and appears here once it takes effect. An add-on’s products are on the add-on’s own subscription.

​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601). On an add-on this is its parent’s scheduled churn date: a scheduled cancellation of the parent ends every add-on with it.

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
billingGroupId
​string | null

The billing group this subscription is billed together with others on, or null when it bills on its own. A grouped subscription is billed on the group’s document and charged on the group’s card, so its own paymentMethodId is null and automaticBilling is false. A subscription that merely has other subscriptions billed as part of its own section is not grouped: it reports null and keeps its own card. So does one that IS such a section. A subscription that has joined a group but not yet reached its first shared billing date already reports the group.

Example: 0197A943-2325-7829-B835-B6C71A293065
GET/v1/subscriptions/{customerSubscriptionId}
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId \ --header 'x-api-key: <api-key>'
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "monthlyRevenue": "15000.00", "hasMeteredProducts": false, "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ], "partnerReferenceId": "order_7f3a9c21", "billingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionName": "Premium Plan", "addons": [ { "subscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "subscriptionName": "Extra seats", "planId": "550e8400-e29b-41d4-a716-446655440000", "status": "active", "addedOn": "2024-03-10", "effectiveNextBillingDate": "2024-04-01", "monthlyRevenue": "99.99", "currency": "DKK" } ], "discounts": [ { "discountId": "0197A943-2325-7829-B835-B6C71A293065", "name": "Loyalty 10%", "type": "percentage", "scope": "line", "percentagePct": "10", "amountInCurrency": null, "active": true, "endsAt": "2026-12-01", "targetsNoProduct": true } ], "products": [ { "productId": "0198A0F1-2B33-7D44-8E55-6F778899AABB", "productName": "Bookkeeping Pro license", "productNumber": "1001", "priceId": "0198A0F1-2B33-7D44-8E55-6F778899AACC", "billingPeriodType": "recurring", "pricingModel": "flat_rate", "quantity": 3, "unitPrice": "499.00", "customPrice": "89.99", "description": "Agreed price for 2026" } ] }
json
application/json

Update a customer subscription

PATCH
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Update payment-related settings on an existing customer subscription.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Update a customer subscription › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

Update a customer subscription › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Update a customer subscription › Request Body

PublicUpdateSubscriptionRequest
paymentMethodId
​string | null

The card linked to the subscription. Send null to remove it. You may also echo back the card already linked (a no-op, so a full-object round-trip works), but you cannot attach or change to a different card - cards are attached by the buyer with their consent, so any value other than the currently-linked card or null is rejected with a 400.

Example: null
automaticBilling
​boolean

Whether to automatically charge the saved card during billing

Example: true
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]

Update a customer subscription › Responses

Customer subscription updated successfully

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
monthlyRevenue
​string · required

What the subscription bills per month today, as a decimal string, in currency, excluding VAT. Every billing interval is converted to one month: a quarter is divided by 3, half a year by 6, a year by 12, and weekly prices are multiplied by 52/12. Plan discounts, interval discounts and recurring surcharges are applied; one-off charges are not included. Add-ons are not included either: each add-on is its own subscription with its own monthlyRevenue, so adding up every subscription counts nothing twice, and the invoice a parent sends carries its own figure plus its add-ons’. Usage-based lines are left out, because their consumption is not known until the period closes: a metered line counts only through a prepaid commitment, or a fee its price charges at zero usage (see hasMeteredProducts, and GET /v1/subscriptions/{id}/usage for the usage recorded so far). A change scheduled for a later date shows from the day it takes effect. During a trial it is the price billing starts at. 0 for a subscription that has not started yet or has ended.

Example: 15000.00
hasMeteredProducts
​boolean · required

Whether any product on the subscription is billed on a meter. When true, monthlyRevenue leaves the metered consumption out; read GET /v1/subscriptions/{id}/usage for the usage recorded so far in the current period.

Example: false
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
addonOfSubscriptionId
​string | null · required

The subscription this one is an add-on of, or null. An add-on bills on its parent’s invoice, inside the parent’s section, and ends when the parent is cancelled.

Example: 0197A943-2325-7829-B835-B6C71A293065
addonOfSubscriptionName
​string | null · required

Current name of the subscription this one is an add-on of, or null when it is not an add-on.

Example: Premium Plan
​PublicSubscriptionAddon[] · required

The add-ons billed on this subscription’s invoice, inside its section. Empty when it has none, and always empty on an add-on — an add-on cannot have add-ons of its own.

​PublicSubscriptionDiscount[] · required

The discount records the subscription references, in the order they apply, each as the record is now with the end date this subscription carries for it. Empty when it references none.

​PublicSubscriptionProduct[] · required

The products the subscription bills today, newest line first. A change scheduled for a later date is listed under GET /v1/subscriptions/{id}/scheduled-changes and appears here once it takes effect. An add-on’s products are on the add-on’s own subscription.

​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601). On an add-on this is its parent’s scheduled churn date: a scheduled cancellation of the parent ends every add-on with it.

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
billingGroupId
​string | null

The billing group this subscription is billed together with others on, or null when it bills on its own. A grouped subscription is billed on the group’s document and charged on the group’s card, so its own paymentMethodId is null and automaticBilling is false. A subscription that merely has other subscriptions billed as part of its own section is not grouped: it reports null and keeps its own card. So does one that IS such a section. A subscription that has joined a group but not yet reached its first shared billing date already reports the group.

Example: 0197A943-2325-7829-B835-B6C71A293065
PATCH/v1/subscriptions/{customerSubscriptionId}
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId \ --request PATCH \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "paymentMethodId": null, "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ] }'
Example Request Body
{ "paymentMethodId": null, "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ] }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "monthlyRevenue": "15000.00", "hasMeteredProducts": false, "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ], "partnerReferenceId": "order_7f3a9c21", "billingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionName": "Premium Plan", "addons": [ { "subscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "subscriptionName": "Extra seats", "planId": "550e8400-e29b-41d4-a716-446655440000", "status": "active", "addedOn": "2024-03-10", "effectiveNextBillingDate": "2024-04-01", "monthlyRevenue": "99.99", "currency": "DKK" } ], "discounts": [ { "discountId": "0197A943-2325-7829-B835-B6C71A293065", "name": "Loyalty 10%", "type": "percentage", "scope": "line", "percentagePct": "10", "amountInCurrency": null, "active": true, "endsAt": "2026-12-01", "targetsNoProduct": true } ], "products": [ { "productId": "0198A0F1-2B33-7D44-8E55-6F778899AABB", "productName": "Bookkeeping Pro license", "productNumber": "1001", "priceId": "0198A0F1-2B33-7D44-8E55-6F778899AACC", "billingPeriodType": "recurring", "pricingModel": "flat_rate", "quantity": 3, "unitPrice": "499.00", "customPrice": "89.99", "description": "Agreed price for 2026" } ] }
json
application/json

Add an add-on to a customer subscription

POST
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/addons
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Creates an add-on of an existing subscription from a plan. The add-on is a subscription of its own — with its own stable id, returned here — that bills on the parent's invoice, inside the parent's section, from the parent's next billing date after today. Cancelling the parent cancels the add-on with it.

The parent supplies the customer, billing direction, invoice terms, recipients and payment details, so the body names only the plan, its product overrides, when the add-on starts, and how the period up to the parent's next billing date is handled. The add-on's plan must bill in the parent's currency.

An add-on cannot have add-ons of its own, so the parent must not itself be an add-on, and a parent with a scheduled cancellation takes no new add-ons. Both are refused with a coded 400 and create nothing.

Returns the new add-on; read the parent to see it listed under addons.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Add an add-on to a customer subscription › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id) of the parent

Add an add-on to a customer subscription › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Add an add-on to a customer subscription › Request Body

PublicCreateSubscriptionAddonRequest
planId
​string · required

Subscription plan ID the add-on is created from

Example: 550e8400-e29b-41d4-a716-446655440000
​PublicAssignSubscriptionProductOverride[] · maxItems: 200

Optional quantity and price overrides for products in the add-on’s plan

cadence
​string

How often the add-on bills, as <interval>-<count> (month-1, month-3, year-1). Omit to bill at the plan’s own cadence. Any other value must be one of the plan’s alternative cadences; one the plan does not offer is refused with 400 SHARED_VALIDATION_FAILED, details.reason = ADDON_CADENCE_NOT_ON_PLAN. An add-on on a shorter cadence than its parent bills its cycles on the parent’s invoice between the parent’s own billing dates.

Example: month-1
startDate
​string

Start date (ISO 8601) — when the customer gets the add-on. Defaults to today. The add-on bills on the parent’s invoices, on cycles that break on the parent’s billing dates walked back to this start: an add-on on the parent’s cadence that starts on one of the parent’s billing dates (today included) bills its first full period from that date.

Example: 2024-03-10
prorationBehavior
​string · enum

How to handle a partial period from startDate to the add-on’s first full cycle on the parent’s grid

Enum values:
create_prorations
always_invoice
none
Example: create_prorations
Default: none

Add an add-on to a customer subscription › Responses

The add-on was created

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
monthlyRevenue
​string · required

What the subscription bills per month today, as a decimal string, in currency, excluding VAT. Every billing interval is converted to one month: a quarter is divided by 3, half a year by 6, a year by 12, and weekly prices are multiplied by 52/12. Plan discounts, interval discounts and recurring surcharges are applied; one-off charges are not included. Add-ons are not included either: each add-on is its own subscription with its own monthlyRevenue, so adding up every subscription counts nothing twice, and the invoice a parent sends carries its own figure plus its add-ons’. Usage-based lines are left out, because their consumption is not known until the period closes: a metered line counts only through a prepaid commitment, or a fee its price charges at zero usage (see hasMeteredProducts, and GET /v1/subscriptions/{id}/usage for the usage recorded so far). A change scheduled for a later date shows from the day it takes effect. During a trial it is the price billing starts at. 0 for a subscription that has not started yet or has ended.

Example: 15000.00
hasMeteredProducts
​boolean · required

Whether any product on the subscription is billed on a meter. When true, monthlyRevenue leaves the metered consumption out; read GET /v1/subscriptions/{id}/usage for the usage recorded so far in the current period.

Example: false
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
addonOfSubscriptionId
​string | null · required

The subscription this one is an add-on of, or null. An add-on bills on its parent’s invoice, inside the parent’s section, and ends when the parent is cancelled.

Example: 0197A943-2325-7829-B835-B6C71A293065
addonOfSubscriptionName
​string | null · required

Current name of the subscription this one is an add-on of, or null when it is not an add-on.

Example: Premium Plan
​PublicSubscriptionAddon[] · required

The add-ons billed on this subscription’s invoice, inside its section. Empty when it has none, and always empty on an add-on — an add-on cannot have add-ons of its own.

​PublicSubscriptionDiscount[] · required

The discount records the subscription references, in the order they apply, each as the record is now with the end date this subscription carries for it. Empty when it references none.

​PublicSubscriptionProduct[] · required

The products the subscription bills today, newest line first. A change scheduled for a later date is listed under GET /v1/subscriptions/{id}/scheduled-changes and appears here once it takes effect. An add-on’s products are on the add-on’s own subscription.

​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601). On an add-on this is its parent’s scheduled churn date: a scheduled cancellation of the parent ends every add-on with it.

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
billingGroupId
​string | null

The billing group this subscription is billed together with others on, or null when it bills on its own. A grouped subscription is billed on the group’s document and charged on the group’s card, so its own paymentMethodId is null and automaticBilling is false. A subscription that merely has other subscriptions billed as part of its own section is not grouped: it reports null and keeps its own card. So does one that IS such a section. A subscription that has joined a group but not yet reached its first shared billing date already reports the group.

Example: 0197A943-2325-7829-B835-B6C71A293065
POST/v1/subscriptions/{customerSubscriptionId}/addons
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/addons \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "planId": "550e8400-e29b-41d4-a716-446655440000", "productOverrides": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 25, "customPrice": "149.00", "committedQuantity": 100, "usageCarryoverMode": "reset", "underageMode": "forfeit", "minimumCommittedQuantity": 0, "committedUnitPrice": 8, "discardPreAssignmentUsage": true } ], "cadence": "month-1", "startDate": "2024-03-10", "prorationBehavior": "create_prorations" }'
Example Request Body
{ "planId": "550e8400-e29b-41d4-a716-446655440000", "productOverrides": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 25, "customPrice": "149.00", "committedQuantity": 100, "usageCarryoverMode": "reset", "underageMode": "forfeit", "minimumCommittedQuantity": 0, "committedUnitPrice": 8, "discardPreAssignmentUsage": true } ], "cadence": "month-1", "startDate": "2024-03-10", "prorationBehavior": "create_prorations" }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "monthlyRevenue": "15000.00", "hasMeteredProducts": false, "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ], "partnerReferenceId": "order_7f3a9c21", "billingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionName": "Premium Plan", "addons": [ { "subscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "subscriptionName": "Extra seats", "planId": "550e8400-e29b-41d4-a716-446655440000", "status": "active", "addedOn": "2024-03-10", "effectiveNextBillingDate": "2024-04-01", "monthlyRevenue": "99.99", "currency": "DKK" } ], "discounts": [ { "discountId": "0197A943-2325-7829-B835-B6C71A293065", "name": "Loyalty 10%", "type": "percentage", "scope": "line", "percentagePct": "10", "amountInCurrency": null, "active": true, "endsAt": "2026-12-01", "targetsNoProduct": true } ], "products": [ { "productId": "0198A0F1-2B33-7D44-8E55-6F778899AABB", "productName": "Bookkeeping Pro license", "productNumber": "1001", "priceId": "0198A0F1-2B33-7D44-8E55-6F778899AACC", "billingPeriodType": "recurring", "pricingModel": "flat_rate", "quantity": 3, "unitPrice": "499.00", "customPrice": "89.99", "description": "Agreed price for 2026" } ] }
json
application/json

Attach existing subscriptions as add-ons

POST
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/addons/attach
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Turns existing subscriptions of the same customer into add-ons of this one. Each keeps its own id, plan and products, and from then on bills on this subscription's invoice, inside its section, and ends when this subscription is cancelled.

This cannot be undone. An add-on cannot be detached again; it ends only by being cancelled. Each attached subscription loses its own saved card, because its invoice is now this subscription's, which only this subscription's card pays. If this subscription is billed together with others in a billing group and the attach leaves that group billing only this one, the group's card is removed too. cardsRemoved names every card the attach stopped charging, and the buyer is told when a group's card comes off. Ask POST /v1/subscriptions/{id}/addons/eligibility first to see the refusals and the cards before committing.

An attached subscription takes this subscription's invoice terms and payment settings, and moves onto its billing dates; one that bills on other dates is prorated onto them. It must belong to the same customer and bill in the same currency and direction, with the same revenue deferral and Leverandørservice setting (SUBSCRIPTION_ADDON_PARENT_MISMATCH). A subscription that is itself an add-on, or that has add-ons of its own, cannot be attached.

Returns this subscription, with the attached ones listed under addons.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Attach existing subscriptions as add-ons › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id) of the parent

Attach existing subscriptions as add-ons › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Attach existing subscriptions as add-ons › Request Body

PublicAttachSubscriptionAddonsRequest
subscriptionIds
​string[] · required

Existing subscriptions of the same customer to turn into add-ons of this one (1-19, each once). Each keeps its own id, plan and products, and from then on bills on this subscription’s invoice.

Example: ["0197A943-2325-7829-B835-B6C71A293065"]

Attach existing subscriptions as add-ons › Responses

The subscriptions were attached as add-ons

PublicAttachSubscriptionAddonsResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
monthlyRevenue
​string · required

What the subscription bills per month today, as a decimal string, in currency, excluding VAT. Every billing interval is converted to one month: a quarter is divided by 3, half a year by 6, a year by 12, and weekly prices are multiplied by 52/12. Plan discounts, interval discounts and recurring surcharges are applied; one-off charges are not included. Add-ons are not included either: each add-on is its own subscription with its own monthlyRevenue, so adding up every subscription counts nothing twice, and the invoice a parent sends carries its own figure plus its add-ons’. Usage-based lines are left out, because their consumption is not known until the period closes: a metered line counts only through a prepaid commitment, or a fee its price charges at zero usage (see hasMeteredProducts, and GET /v1/subscriptions/{id}/usage for the usage recorded so far). A change scheduled for a later date shows from the day it takes effect. During a trial it is the price billing starts at. 0 for a subscription that has not started yet or has ended.

Example: 15000.00
hasMeteredProducts
​boolean · required

Whether any product on the subscription is billed on a meter. When true, monthlyRevenue leaves the metered consumption out; read GET /v1/subscriptions/{id}/usage for the usage recorded so far in the current period.

Example: false
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
addonOfSubscriptionId
​string | null · required

The subscription this one is an add-on of, or null. An add-on bills on its parent’s invoice, inside the parent’s section, and ends when the parent is cancelled.

Example: 0197A943-2325-7829-B835-B6C71A293065
addonOfSubscriptionName
​string | null · required

Current name of the subscription this one is an add-on of, or null when it is not an add-on.

Example: Premium Plan
​PublicSubscriptionAddon[] · required

The add-ons billed on this subscription’s invoice, inside its section. Empty when it has none, and always empty on an add-on — an add-on cannot have add-ons of its own.

​PublicSubscriptionDiscount[] · required

The discount records the subscription references, in the order they apply, each as the record is now with the end date this subscription carries for it. Empty when it references none.

​PublicSubscriptionProduct[] · required

The products the subscription bills today, newest line first. A change scheduled for a later date is listed under GET /v1/subscriptions/{id}/scheduled-changes and appears here once it takes effect. An add-on’s products are on the add-on’s own subscription.

​PublicRemovedCard[] · required

The saved cards the attach stopped charging. Empty when none was.

​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601). On an add-on this is its parent’s scheduled churn date: a scheduled cancellation of the parent ends every add-on with it.

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
billingGroupId
​string | null

The billing group this subscription is billed together with others on, or null when it bills on its own. A grouped subscription is billed on the group’s document and charged on the group’s card, so its own paymentMethodId is null and automaticBilling is false. A subscription that merely has other subscriptions billed as part of its own section is not grouped: it reports null and keeps its own card. So does one that IS such a section. A subscription that has joined a group but not yet reached its first shared billing date already reports the group.

Example: 0197A943-2325-7829-B835-B6C71A293065
POST/v1/subscriptions/{customerSubscriptionId}/addons/attach
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/addons/attach \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "subscriptionIds": [ "0197A943-2325-7829-B835-B6C71A293065" ] }'
Example Request Body
{ "subscriptionIds": [ "0197A943-2325-7829-B835-B6C71A293065" ] }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "monthlyRevenue": "15000.00", "hasMeteredProducts": false, "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ], "partnerReferenceId": "order_7f3a9c21", "billingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionName": "Premium Plan", "addons": [ { "subscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "subscriptionName": "Extra seats", "planId": "550e8400-e29b-41d4-a716-446655440000", "status": "active", "addedOn": "2024-03-10", "effectiveNextBillingDate": "2024-04-01", "monthlyRevenue": "99.99", "currency": "DKK" } ], "discounts": [ { "discountId": "0197A943-2325-7829-B835-B6C71A293065", "name": "Loyalty 10%", "type": "percentage", "scope": "line", "percentagePct": "10", "amountInCurrency": null, "active": true, "endsAt": "2026-12-01", "targetsNoProduct": true } ], "products": [ { "productId": "0198A0F1-2B33-7D44-8E55-6F778899AABB", "productName": "Bookkeeping Pro license", "productNumber": "1001", "priceId": "0198A0F1-2B33-7D44-8E55-6F778899AACC", "billingPeriodType": "recurring", "pricingModel": "flat_rate", "quantity": 3, "unitPrice": "499.00", "customPrice": "89.99", "description": "Agreed price for 2026" } ], "cardsRemoved": [ { "subscriptionId": "subscriptionId", "billingGroupId": "billingGroupId", "paymentMethodId": "0197A943-2325-7829-B835-B6C71A293065" } ] }
json
application/json

Check whether subscriptions can become add-ons

POST
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/addons/eligibility
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Asks, without changing anything, whether this subscription can take add-ons and whether the named existing subscriptions could be attached to it as add-ons with POST /v1/subscriptions/{id}/addons/attach. Every refusal the attach would answer is reported at once, where the attach itself stops at the first. Omit subscriptionIds to ask only about this subscription.

cardsRemoved lists the saved cards the attach would stop charging: each attached subscription's own card, since an add-on bills on its parent's invoice, and a billing group's card when the attach would leave that group billing one subscription. Attaching cannot be undone.

An unknown subscription is a 404.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Check whether subscriptions can become add-ons › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id) of the parent

Check whether subscriptions can become add-ons › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Check whether subscriptions can become add-ons › Request Body

PublicSubscriptionAddonEligibilityRequest
subscriptionIds
​string[]

Existing subscriptions you intend to attach as add-ons (0-19, each once). Omit to ask only whether this subscription can take add-ons at all.

Example: ["0197A943-2325-7829-B835-B6C71A293065"]

Check whether subscriptions can become add-ons › Responses

Whether the attach would be accepted, every refusal it would answer with, and the cards it removes

PublicSubscriptionAddonEligibilityResponse
eligible
​boolean · required

True when the attach would be accepted as asked

​PublicAddonRefusal[] · required

Every refusal the attach would answer, one per problem

​PublicRemovedCard[] · required

The saved cards the attach would stop charging. Attaching cannot be undone, and a removed card is not put back: the buyer adds one again through a card flow if they want it.

POST/v1/subscriptions/{customerSubscriptionId}/addons/eligibility
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/addons/eligibility \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "subscriptionIds": [ "0197A943-2325-7829-B835-B6C71A293065" ] }'
Example Request Body
{ "subscriptionIds": [ "0197A943-2325-7829-B835-B6C71A293065" ] }
json
application/json
Example Responses
{ "eligible": true, "refusals": [ { "code": "SUBSCRIPTION_ADDON_PARENT_MISMATCH", "subscriptionId": "subscriptionId", "details": {} } ], "cardsRemoved": [ { "subscriptionId": "subscriptionId", "billingGroupId": "billingGroupId", "paymentMethodId": "0197A943-2325-7829-B835-B6C71A293065" } ] }
json
application/json

Change the products on a customer subscription

POST
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/product-changes
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Changes the quantity, price and description of a subscription's product lines, and adds or removes lines, from effectiveDate. The subscription keeps its id and is not cancelled, so revenue reports measure the change as this subscription's revenue moving up or down, not as one subscription ending and another starting.

products lists every line the subscription has from the effective date: a price the subscription carries today changes that line, a new price adds a line, and a price left out of the list is removed. A field a line leaves out keeps the value that line has on the date (its dimensions and any prepaid usage commitment are always kept); send customPrice: null to go back to the list price, or description: null to remove the description.

A future effectiveDate queues the change: it appears in the subscription's scheduled changes until it takes effect, and can be cancelled there. Today or an earlier date takes effect at once; the earliest date accepted is the day the subscription's current terms took effect.

On a subscription billed in arrears, the invoice at the end of the period bills each part of the period at the terms in force, by days. On one billed in advance, prorationBehavior decides how the period the date falls inside is settled.

The change is refused with 400 when it changes nothing (SUBSCRIPTION_EDIT_PRODUCTS_NO_CHANGES), when it sets a quantity or a price on a usage-metered line (SUBSCRIPTION_CANNOT_SET_QUANTITY_FOR_USAGE_BASED), when a price is listed twice (SUBSCRIPTION_PRODUCT_ALREADY_ADDED), and when a subscription charged to a card would fall below the smallest amount the card can be charged (SUBSCRIPTION_CARD_BELOW_MINIMUM). A subscription that was already below that amount keeps the change, and its automatic card payment is switched off. A date before the current terms took effect, or after the subscription's end date, is refused with SUBSCRIPTION_REPLACE_PLAN_EFFECTIVE_DATE_OUT_OF_RANGE; a date on or before the start of a period already invoiced in advance with SUBSCRIPTION_MUTATION_SUPERSEDES_PREBILLED_PERIOD; and a subscription that is not active, in trial, or scheduled to start with SUBSCRIPTION_REPLACE_PLAN_REQUIRES_ACTIVE_SUBSCRIPTION.

Returns the subscription's current state.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Change the products on a customer subscription › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

Change the products on a customer subscription › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Change the products on a customer subscription › Request Body

PublicChangeSubscriptionProductsRequest
effectiveDate
​string · required

The date the change takes effect (YYYY-MM-DD). A date in the future queues the change; it is listed under the subscription’s scheduled changes until then. Today or an earlier date takes effect at once; the earliest date accepted is the day the subscription’s current terms took effect.

Example: 2026-11-01
​PublicSubscriptionProductChangeLine[] · minItems: 1 · maxItems: 50

Every product line the subscription has from the effective date. A line for a price the subscription carries today changes that line; a line for a new price adds it; a price left out of the list is removed. Each price may appear once. May be left out when the change sends discountIds or discountEndDates: the products then stay as they are.

discountIds
​string[] · maxItems: 20

The full set of discount records the subscription references from the effective date, in the order they apply. Omit to keep the ones it has; [] removes them all. A discount added is checked and takes one use of its limits; one removed gives its use back unless an invoice already applied it. The refusals are those of discountIds on POST /v1/subscriptions.

​PublicSubscriptionDiscountEndDate[] · maxItems: 20

End dates for discounts the subscription references after the change, replacing the ones they have. A period that starts on or after the end date is billed without the discount; null removes the end. A discount the subscription does not reference is refused with DISCOUNT_END_DATE_NOT_REFERENCED.

prorationBehavior
​string · enum

How the billing period the effective date falls inside is settled on a subscription billed in advance. The modes are described in the Proration guide. Omit for create_prorations. A subscription billed in arrears ignores it: its invoice at the end of the period bills each part of the period at the terms in force, by days.

Enum values:
create_prorations
always_invoice
none
Example: create_prorations

Change the products on a customer subscription › Responses

Products changed; the subscription’s current state

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
monthlyRevenue
​string · required

What the subscription bills per month today, as a decimal string, in currency, excluding VAT. Every billing interval is converted to one month: a quarter is divided by 3, half a year by 6, a year by 12, and weekly prices are multiplied by 52/12. Plan discounts, interval discounts and recurring surcharges are applied; one-off charges are not included. Add-ons are not included either: each add-on is its own subscription with its own monthlyRevenue, so adding up every subscription counts nothing twice, and the invoice a parent sends carries its own figure plus its add-ons’. Usage-based lines are left out, because their consumption is not known until the period closes: a metered line counts only through a prepaid commitment, or a fee its price charges at zero usage (see hasMeteredProducts, and GET /v1/subscriptions/{id}/usage for the usage recorded so far). A change scheduled for a later date shows from the day it takes effect. During a trial it is the price billing starts at. 0 for a subscription that has not started yet or has ended.

Example: 15000.00
hasMeteredProducts
​boolean · required

Whether any product on the subscription is billed on a meter. When true, monthlyRevenue leaves the metered consumption out; read GET /v1/subscriptions/{id}/usage for the usage recorded so far in the current period.

Example: false
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
addonOfSubscriptionId
​string | null · required

The subscription this one is an add-on of, or null. An add-on bills on its parent’s invoice, inside the parent’s section, and ends when the parent is cancelled.

Example: 0197A943-2325-7829-B835-B6C71A293065
addonOfSubscriptionName
​string | null · required

Current name of the subscription this one is an add-on of, or null when it is not an add-on.

Example: Premium Plan
​PublicSubscriptionAddon[] · required

The add-ons billed on this subscription’s invoice, inside its section. Empty when it has none, and always empty on an add-on — an add-on cannot have add-ons of its own.

​PublicSubscriptionDiscount[] · required

The discount records the subscription references, in the order they apply, each as the record is now with the end date this subscription carries for it. Empty when it references none.

​PublicSubscriptionProduct[] · required

The products the subscription bills today, newest line first. A change scheduled for a later date is listed under GET /v1/subscriptions/{id}/scheduled-changes and appears here once it takes effect. An add-on’s products are on the add-on’s own subscription.

​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601). On an add-on this is its parent’s scheduled churn date: a scheduled cancellation of the parent ends every add-on with it.

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
billingGroupId
​string | null

The billing group this subscription is billed together with others on, or null when it bills on its own. A grouped subscription is billed on the group’s document and charged on the group’s card, so its own paymentMethodId is null and automaticBilling is false. A subscription that merely has other subscriptions billed as part of its own section is not grouped: it reports null and keeps its own card. So does one that IS such a section. A subscription that has joined a group but not yet reached its first shared billing date already reports the group.

Example: 0197A943-2325-7829-B835-B6C71A293065
POST/v1/subscriptions/{customerSubscriptionId}/product-changes
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/product-changes \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "effectiveDate": "2026-11-01", "products": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 3, "customPrice": "149.00", "description": "Support seats" } ], "discountIds": [ "string" ], "discountEndDates": [ { "discountId": "string", "endsAt": "2026-12-01" } ], "prorationBehavior": "create_prorations" }'
Example Request Body
{ "effectiveDate": "2026-11-01", "products": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 3, "customPrice": "149.00", "description": "Support seats" } ], "discountIds": [ "string" ], "discountEndDates": [ { "discountId": "string", "endsAt": "2026-12-01" } ], "prorationBehavior": "create_prorations" }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "monthlyRevenue": "15000.00", "hasMeteredProducts": false, "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ], "partnerReferenceId": "order_7f3a9c21", "billingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionName": "Premium Plan", "addons": [ { "subscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "subscriptionName": "Extra seats", "planId": "550e8400-e29b-41d4-a716-446655440000", "status": "active", "addedOn": "2024-03-10", "effectiveNextBillingDate": "2024-04-01", "monthlyRevenue": "99.99", "currency": "DKK" } ], "discounts": [ { "discountId": "0197A943-2325-7829-B835-B6C71A293065", "name": "Loyalty 10%", "type": "percentage", "scope": "line", "percentagePct": "10", "amountInCurrency": null, "active": true, "endsAt": "2026-12-01", "targetsNoProduct": true } ], "products": [ { "productId": "0198A0F1-2B33-7D44-8E55-6F778899AABB", "productName": "Bookkeeping Pro license", "productNumber": "1001", "priceId": "0198A0F1-2B33-7D44-8E55-6F778899AACC", "billingPeriodType": "recurring", "pricingModel": "flat_rate", "quantity": 3, "unitPrice": "499.00", "customPrice": "89.99", "description": "Agreed price for 2026" } ] }
json
application/json

Retry a failed card payment

POST
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/retry-payment
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Recharges the saved card for a subscription parked in awaiting_payment after a failed charge — the API twin of the buyer portal's "Pay now".

The retry targets the outstanding unpaid card invoice; there is no request body. It works while automatic retries are still running AND after dunning is exhausted (it re-opens the exhausted attempt), and it ignores the automatic ladder's backoff schedule. A cleared retry settles the invoice, resumes the subscription, and fires the subscription.payment_succeeded webhook.

Failure states return coded errors: PORTAL_RETRY_PAYMENT_NOT_AVAILABLE (the subscription is not awaiting payment, has no unpaid card invoice, or has automatic billing disabled), PORTAL_RETRY_PAYMENT_IN_PROGRESS (a concurrent charge holds the claim, or the invoice was just paid — re-read the subscription), and PORTAL_RETRY_PAYMENT_DECLINED (the card genuinely declined). The codes carry the PORTAL_ prefix because this endpoint shares its implementation with the buyer portal's own retry.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Retry a failed card payment › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

Retry a failed card payment › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Retry a failed card payment › Responses

The retry charge cleared and the invoice is settled

PublicRetryPaymentResponseDTO
status
​string · required

Always "succeeded" — a failed retry returns a coded error instead.

Example: succeeded
subscriptionId
​string · required

The stable subscription id the retry ran against.

Example: 01890a5d-ac96-774b-b9aa-9d0f8f6c3b45
invoiceId
​string · required

Id of the outstanding invoice the cleared charge paid.

Example: 01890a5d-ac96-774b-b9aa-9d0f8f6c3b46
POST/v1/subscriptions/{customerSubscriptionId}/retry-payment
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/retry-payment \ --request POST \ --header 'x-api-key: <api-key>'
Example Responses
{ "status": "succeeded", "subscriptionId": "01890a5d-ac96-774b-b9aa-9d0f8f6c3b45", "invoiceId": "01890a5d-ac96-774b-b9aa-9d0f8f6c3b46" }
json
application/json

List a subscription's pending scheduled changes

GET
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/scheduled-changes
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Returns the queued, not-yet-active changes on the subscription — future-dated plan replacements, billing-direction / cadence changes, and scheduled cancellations. Each carries a changeId that can be cancelled individually. Empty array when nothing is queued.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

List a subscription's pending scheduled changes › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

List a subscription's pending scheduled changes › Responses

The list of pending scheduled changes

PublicScheduledChange
changeId
​string · required

Identifier of this queued change. Ephemeral — valid only until the change activates or is cancelled, so re-fetch rather than caching it.

Example: 550e8400-e29b-41d4-a716-446655440000
kind
​string · required

The kind of queued change: one of replace_plan, edit_products, change_direction, or churn.

Example: replace_plan
effectiveDate
​string · required

The date (YYYY-MM-DD) the change takes effect.

Example: 2024-07-01
planId
​string | null · required

The plan the subscription moves to when the change activates (null for ad-hoc / non-plan changes).

Example: 550e8400-e29b-41d4-a716-446655440000
subscriptionName
​string · required

The plan name the change moves to.

Example: Pro (annual)
GET/v1/subscriptions/{customerSubscriptionId}/scheduled-changes
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/scheduled-changes \ --header 'x-api-key: <api-key>'
Example Responses
{ "changeId": "550e8400-e29b-41d4-a716-446655440000", "kind": "replace_plan", "effectiveDate": "2024-07-01", "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Pro (annual)" }
json
application/json

Cancel a single pending scheduled change

DELETE
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/scheduled-changes/{changeId}
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Cancels exactly one queued change (from the scheduled-changes list) without ending the subscription or touching its other scheduled changes. Returns the subscription’s current state. A changeId that has already activated or been cancelled returns 404.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Cancel a single pending scheduled change › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

changeId
​string · required

The changeId of the scheduled change to cancel

Cancel a single pending scheduled change › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Cancel a single pending scheduled change › Responses

Scheduled change cancelled; the subscription’s current state

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
monthlyRevenue
​string · required

What the subscription bills per month today, as a decimal string, in currency, excluding VAT. Every billing interval is converted to one month: a quarter is divided by 3, half a year by 6, a year by 12, and weekly prices are multiplied by 52/12. Plan discounts, interval discounts and recurring surcharges are applied; one-off charges are not included. Add-ons are not included either: each add-on is its own subscription with its own monthlyRevenue, so adding up every subscription counts nothing twice, and the invoice a parent sends carries its own figure plus its add-ons’. Usage-based lines are left out, because their consumption is not known until the period closes: a metered line counts only through a prepaid commitment, or a fee its price charges at zero usage (see hasMeteredProducts, and GET /v1/subscriptions/{id}/usage for the usage recorded so far). A change scheduled for a later date shows from the day it takes effect. During a trial it is the price billing starts at. 0 for a subscription that has not started yet or has ended.

Example: 15000.00
hasMeteredProducts
​boolean · required

Whether any product on the subscription is billed on a meter. When true, monthlyRevenue leaves the metered consumption out; read GET /v1/subscriptions/{id}/usage for the usage recorded so far in the current period.

Example: false
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
addonOfSubscriptionId
​string | null · required

The subscription this one is an add-on of, or null. An add-on bills on its parent’s invoice, inside the parent’s section, and ends when the parent is cancelled.

Example: 0197A943-2325-7829-B835-B6C71A293065
addonOfSubscriptionName
​string | null · required

Current name of the subscription this one is an add-on of, or null when it is not an add-on.

Example: Premium Plan
​PublicSubscriptionAddon[] · required

The add-ons billed on this subscription’s invoice, inside its section. Empty when it has none, and always empty on an add-on — an add-on cannot have add-ons of its own.

​PublicSubscriptionDiscount[] · required

The discount records the subscription references, in the order they apply, each as the record is now with the end date this subscription carries for it. Empty when it references none.

​PublicSubscriptionProduct[] · required

The products the subscription bills today, newest line first. A change scheduled for a later date is listed under GET /v1/subscriptions/{id}/scheduled-changes and appears here once it takes effect. An add-on’s products are on the add-on’s own subscription.

​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601). On an add-on this is its parent’s scheduled churn date: a scheduled cancellation of the parent ends every add-on with it.

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
billingGroupId
​string | null

The billing group this subscription is billed together with others on, or null when it bills on its own. A grouped subscription is billed on the group’s document and charged on the group’s card, so its own paymentMethodId is null and automaticBilling is false. A subscription that merely has other subscriptions billed as part of its own section is not grouped: it reports null and keeps its own card. So does one that IS such a section. A subscription that has joined a group but not yet reached its first shared billing date already reports the group.

Example: 0197A943-2325-7829-B835-B6C71A293065
DELETE/v1/subscriptions/{customerSubscriptionId}/scheduled-changes/{changeId}
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/scheduled-changes/:changeId \ --request DELETE \ --header 'x-api-key: <api-key>'
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "monthlyRevenue": "15000.00", "hasMeteredProducts": false, "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ], "partnerReferenceId": "order_7f3a9c21", "billingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionName": "Premium Plan", "addons": [ { "subscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "subscriptionName": "Extra seats", "planId": "550e8400-e29b-41d4-a716-446655440000", "status": "active", "addedOn": "2024-03-10", "effectiveNextBillingDate": "2024-04-01", "monthlyRevenue": "99.99", "currency": "DKK" } ], "discounts": [ { "discountId": "0197A943-2325-7829-B835-B6C71A293065", "name": "Loyalty 10%", "type": "percentage", "scope": "line", "percentagePct": "10", "amountInCurrency": null, "active": true, "endsAt": "2026-12-01", "targetsNoProduct": true } ], "products": [ { "productId": "0198A0F1-2B33-7D44-8E55-6F778899AABB", "productName": "Bookkeeping Pro license", "productNumber": "1001", "priceId": "0198A0F1-2B33-7D44-8E55-6F778899AACC", "billingPeriodType": "recurring", "pricingModel": "flat_rate", "quantity": 3, "unitPrice": "499.00", "customPrice": "89.99", "description": "Agreed price for 2026" } ] }
json
application/json

Get a subscription's unbilled usage

GET
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/usage
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Returns the usage the subscription has recorded but not yet been invoiced for, one entry per metered price and billing period, priced the way the invoice will price it. Use it beside monthlyRevenue, which leaves metered consumption out.

Usage is billed in arrears: a period's usage is invoiced when the period closes (periodEnd). amount is what the usage recorded so far comes to, excluding VAT and before any plan or interval discount. For a prepaid commitment it is only the settlement above (or, with refunds, below) what was prepaid. Usage is recorded per customer and meter, so a line flagged quantityIsShared reports units another line also bills.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Get a subscription's unbilled usage › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

Get a subscription's unbilled usage › query Parameters

asOf
​string

ISO date (YYYY-MM-DD) to read the usage as of: it decides which billing period is current. Defaults to today.

Example: 2026-10-01

Get a subscription's unbilled usage › Responses

The unbilled usage

PublicSubscriptionUsage
subscriptionId
​string · required

The stable subscription id.

Example: 019F3C59-7988-7264-82D7-EB456918ED02
currency
​string · required

Currency code (ISO 4217) of every amount.

Example: DKK
​PublicSubscriptionUsageLine[] · required

One entry per metered price and billing period that has usage not yet invoiced. A subscription behind on billing can report more than one period for a price. Empty when the subscription has no metered products.

GET/v1/subscriptions/{customerSubscriptionId}/usage
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/usage \ --header 'x-api-key: <api-key>'
Example Responses
{ "subscriptionId": "019F3C59-7988-7264-82D7-EB456918ED02", "currency": "DKK", "lines": [ { "meterId": "0197A943-2325-7829-B835-B6C71A293065", "meterName": "Bookings", "priceId": "0197A943-2325-7829-B835-B6C71A293065", "productName": "Commission", "periodStart": "2026-10-01", "periodEnd": "2026-11-01", "quantity": 1250, "amount": "4950.00", "quantityIsShared": false } ] }
json
application/json

Cancel a customer subscription

POST
https://api.ledgerbee.com/api
/v1/subscriptions/cancel
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Cancels (churns) a customer subscription according to the chosen strategy — at the end of the current billing cycle, immediately, or on a specific date.

effectiveDate is required when the strategy is SPECIFIC_DATE, and refundBehavior only applies when cancelling immediately. A non-immediate cancellation is queued and appears in the subscription's scheduled-changes list until it takes effect.

Cancelling a subscription that has add-ons cancels its add-ons with it. cascadedAddonSubscriptionIds names them: on an immediate cancellation, the add-ons that ended now; on a scheduled one, the add-ons that will end with it, as they stand when the request is made.

Returns the subscription's current state after the command is applied.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Cancel a customer subscription › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Cancel a customer subscription › Request Body

PublicCancelSubscriptionRequest
id
​string · required

Customer subscription ID to cancel

Example: 550e8400-e29b-41d4-a716-446655440000
strategy
​string · enum · required

Cancellation strategy

Enum values:
immediately
end_of_cycle
specific_date
clear_schedule
Example: end_of_cycle
effectiveDate
​string

Effective churn date (ISO 8601). Required when strategy is SPECIFIC_DATE.

Example: 2024-06-30
refundBehavior
​string · enum

Refund behavior when canceling immediately

Enum values:
none
last_invoice
prorated
Example: none
Default: none
cancellationReason
​string

Optional reason for cancelling the subscription

Example: Customer requested downgrade

Cancel a customer subscription › Responses

Customer subscription cancelled successfully

PublicCancelSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
monthlyRevenue
​string · required

What the subscription bills per month today, as a decimal string, in currency, excluding VAT. Every billing interval is converted to one month: a quarter is divided by 3, half a year by 6, a year by 12, and weekly prices are multiplied by 52/12. Plan discounts, interval discounts and recurring surcharges are applied; one-off charges are not included. Add-ons are not included either: each add-on is its own subscription with its own monthlyRevenue, so adding up every subscription counts nothing twice, and the invoice a parent sends carries its own figure plus its add-ons’. Usage-based lines are left out, because their consumption is not known until the period closes: a metered line counts only through a prepaid commitment, or a fee its price charges at zero usage (see hasMeteredProducts, and GET /v1/subscriptions/{id}/usage for the usage recorded so far). A change scheduled for a later date shows from the day it takes effect. During a trial it is the price billing starts at. 0 for a subscription that has not started yet or has ended.

Example: 15000.00
hasMeteredProducts
​boolean · required

Whether any product on the subscription is billed on a meter. When true, monthlyRevenue leaves the metered consumption out; read GET /v1/subscriptions/{id}/usage for the usage recorded so far in the current period.

Example: false
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
addonOfSubscriptionId
​string | null · required

The subscription this one is an add-on of, or null. An add-on bills on its parent’s invoice, inside the parent’s section, and ends when the parent is cancelled.

Example: 0197A943-2325-7829-B835-B6C71A293065
addonOfSubscriptionName
​string | null · required

Current name of the subscription this one is an add-on of, or null when it is not an add-on.

Example: Premium Plan
​PublicSubscriptionAddon[] · required

The add-ons billed on this subscription’s invoice, inside its section. Empty when it has none, and always empty on an add-on — an add-on cannot have add-ons of its own.

​PublicSubscriptionDiscount[] · required

The discount records the subscription references, in the order they apply, each as the record is now with the end date this subscription carries for it. Empty when it references none.

​PublicSubscriptionProduct[] · required

The products the subscription bills today, newest line first. A change scheduled for a later date is listed under GET /v1/subscriptions/{id}/scheduled-changes and appears here once it takes effect. An add-on’s products are on the add-on’s own subscription.

cascadedAddonSubscriptionIds
​string[] · required

The add-ons cancelled together with this subscription, by their subscription ids. On an immediate cancellation these ended now; on a scheduled one they are the add-ons that will end with it, as they stand when the request is made. Empty when the subscription has no add-ons, and for clear_schedule.

Example: ["0197A943-2325-7829-B835-B6C71A293065"]
​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601). On an add-on this is its parent’s scheduled churn date: a scheduled cancellation of the parent ends every add-on with it.

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
allowedPaymentProviders
​string[]

The connected card provider the buyer may pay this subscription with - at most one. Empty means card payment is off. A subscription needs it before the buyer can add a first card through POST /v1/checkout/subscriptions/{id}/card-window, which otherwise answers 400 SUBSCRIPTION_MANAGE_PROVIDER_NOT_ALLOWED. It allows card payment and attaches no card: the buyer still enters the card themselves. Two providers of the same kind answer 400 INVOICE_MULTIPLE_CARD_PROVIDERS.

Enum values:
ONPAY
STRIPE
Example: ["STRIPE"]
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
billingGroupId
​string | null

The billing group this subscription is billed together with others on, or null when it bills on its own. A grouped subscription is billed on the group’s document and charged on the group’s card, so its own paymentMethodId is null and automaticBilling is false. A subscription that merely has other subscriptions billed as part of its own section is not grouped: it reports null and keeps its own card. So does one that IS such a section. A subscription that has joined a group but not yet reached its first shared billing date already reports the group.

Example: 0197A943-2325-7829-B835-B6C71A293065
POST/v1/subscriptions/cancel
curl https://api.ledgerbee.com/api/v1/subscriptions/cancel \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "id": "550e8400-e29b-41d4-a716-446655440000", "strategy": "end_of_cycle", "effectiveDate": "2024-06-30", "refundBehavior": "none", "cancellationReason": "Customer requested downgrade" }'
Example Request Body
{ "id": "550e8400-e29b-41d4-a716-446655440000", "strategy": "end_of_cycle", "effectiveDate": "2024-06-30", "refundBehavior": "none", "cancellationReason": "Customer requested downgrade" }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "monthlyRevenue": "15000.00", "hasMeteredProducts": false, "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "allowedPaymentProviders": [ "STRIPE" ], "partnerReferenceId": "order_7f3a9c21", "billingGroupId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "addonOfSubscriptionName": "Premium Plan", "addons": [ { "subscriptionId": "0197A943-2325-7829-B835-B6C71A293065", "subscriptionName": "Extra seats", "planId": "550e8400-e29b-41d4-a716-446655440000", "status": "active", "addedOn": "2024-03-10", "effectiveNextBillingDate": "2024-04-01", "monthlyRevenue": "99.99", "currency": "DKK" } ], "discounts": [ { "discountId": "0197A943-2325-7829-B835-B6C71A293065", "name": "Loyalty 10%", "type": "percentage", "scope": "line", "percentagePct": "10", "amountInCurrency": null, "active": true, "endsAt": "2026-12-01", "targetsNoProduct": true } ], "products": [ { "productId": "0198A0F1-2B33-7D44-8E55-6F778899AABB", "productName": "Bookkeeping Pro license", "productNumber": "1001", "priceId": "0198A0F1-2B33-7D44-8E55-6F778899AACC", "billingPeriodType": "recurring", "pricingModel": "flat_rate", "quantity": 3, "unitPrice": "499.00", "customPrice": "89.99", "description": "Agreed price for 2026" } ], "cascadedAddonSubscriptionIds": [ "0197A943-2325-7829-B835-B6C71A293065" ] }
json
application/json

List subscription plans

GET
https://api.ledgerbee.com/api
/v1/subscriptions/plans
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Retrieves a paginated list of your company's subscription plans.

Only active plans are returned — archived plans are excluded. Pass ?search= to filter the list by free text.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

List subscription plans › query Parameters

page
​number · min: 1

Page number (1-indexed)

Example: 1
Default: 1
limit
​number · min: 1 · max: 100

Number of items per page

Example: 25
Default: 25
search
​string

Search by plan name

List subscription plans › Responses

List of subscription plans

PublicListSubscriptionPlansResponse
​PublicSubscriptionPlanResponse[] · required

List of subscription plans

total
​number · required

Total number of subscription plans matching the query

Example: 42
page
​number · required

Current page number (1-indexed)

Example: 1
limit
​number · required

Maximum number of items per page

Example: 25
totalPages
​number · required

Total number of pages available

Example: 2
GET/v1/subscriptions/plans
curl https://api.ledgerbee.com/api/v1/subscriptions/plans \ --header 'x-api-key: <api-key>'
Example Responses
{ "data": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Premium Plan", "description": "Our premium subscription plan with all features", "isActive": true, "currency": "DKK", "defaultBillingDirection": "advance", "phases": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "sequence": 1, "name": "Intro promo", "discountType": "percentage", "discountValue": "10.00", "durationValue": 3, "durationUnit": "month", "products": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 1, "customPrice": "89.99" } ], "intervalDiscounts": [ { "billingInterval": "month", "billingIntervalCount": 1, "discountType": "flat", "value": "50.00", "description": "Negotiated rate discount" } ] } ], "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" } ], "total": 42, "page": 1, "limit": 25, "totalPages": 2 }
json
application/json

Create a subscription plan

POST
https://api.ledgerbee.com/api
/v1/subscriptions/plans
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Creates a new subscription plan (template) that can later be assigned to customers.

A plan is made up of one or more phases, and each phase lists the products it bills via their existing priceId. Set durationValue / durationUnit on a phase to make it time-bounded; omit them on the last phase to leave it open-ended. When currency is omitted the company's base currency is used, and when defaultBillingDirection is omitted the plan defaults to in-advance (ADVANCE) billing.

The created plan is returned, including the generated plan and phase ids.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Create a subscription plan › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Create a subscription plan › Request Body

PublicCreateSubscriptionPlanRequest
name
​string · required

Subscription plan name. Must be unique within your company.

Example: Premium Plan
​PublicCreateSubscriptionPlanPhase[] · maxItems: 50 · required

Phases defining the plan’s billing structure. At least one phase is required.

description
​string

Subscription plan description

Example: Our premium subscription plan with all features
currency
​string · minLength: 3 · maxLength: 3

Currency code (ISO 4217). Omit to bill in the company's own base currency.

Example: DKK
defaultBillingDirection
​string · enum

Default billing direction applied to new customer subscriptions created from this plan

Enum values:
advance
arrears
Example: advance

Create a subscription plan › Responses

Subscription plan created successfully

PublicSubscriptionPlanResponse
id
​string · required

Subscription plan ID

Example: 550e8400-e29b-41d4-a716-446655440000
name
​string · required

Subscription plan name

Example: Premium Plan
isActive
​boolean · required

Whether the subscription plan is active

Example: true
currency
​string · required

Currency code (ISO 4217)

Example: DKK
defaultBillingDirection
​string · enum · required

Default billing direction for new customer subscriptions

Enum values:
advance
arrears
Example: advance
​PublicSubscriptionPlanPhase[] · required

Phases configured for this plan

createdAt
​string · required

Date the plan was created

Example: 2024-01-01T00:00:00.000Z
updatedAt
​string · required

Date the plan was last updated

Example: 2024-01-01T00:00:00.000Z
description
​string

Subscription plan description

Example: Our premium subscription plan with all features
POST/v1/subscriptions/plans
curl https://api.ledgerbee.com/api/v1/subscriptions/plans \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "name": "Premium Plan", "description": "Our premium subscription plan with all features", "currency": "DKK", "defaultBillingDirection": "advance", "phases": [ { "name": "Intro promo", "products": [], "discountType": "none", "discountValue": "10.00", "intervalDiscounts": [], "durationValue": 3, "durationUnit": "month" } ] }'
Example Request Body
{ "name": "Premium Plan", "description": "Our premium subscription plan with all features", "currency": "DKK", "defaultBillingDirection": "advance", "phases": [ { "name": "Intro promo", "products": [], "discountType": "none", "discountValue": "10.00", "intervalDiscounts": [], "durationValue": 3, "durationUnit": "month" } ] }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Premium Plan", "description": "Our premium subscription plan with all features", "isActive": true, "currency": "DKK", "defaultBillingDirection": "advance", "phases": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "sequence": 1, "name": "Intro promo", "discountType": "percentage", "discountValue": "10.00", "durationValue": 3, "durationUnit": "month", "products": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 1, "customPrice": "89.99" } ], "intervalDiscounts": [ { "billingInterval": "month", "billingIntervalCount": 1, "discountType": "flat", "value": "50.00", "description": "Negotiated rate discount" } ] } ], "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" }
json
application/json

Archive a subscription plan

POST
https://api.ledgerbee.com/api
/v1/subscriptions/plans/archive/{planId}
x-api-key (header)
or
OAuth 2.0

Credential: a company's API key or OAuth token.

Archives a subscription plan. Fails if the plan has any active or pending-cancellation customer subscriptions.

Archived plans no longer appear in the plan list.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Archive a subscription plan › path Parameters

planId
​string · required

The subscription plan ID

Archive a subscription plan › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Archive a subscription plan › Responses

Subscription plan archived successfully

No data returned
POST/v1/subscriptions/plans/archive/{planId}
curl https://api.ledgerbee.com/api/v1/subscriptions/plans/archive/:planId \ --request POST \ --header 'x-api-key: <api-key>'
Example Responses
No example specified for this content type

StockSuppliers