Developer Docs

Developer Docs

  • Getting Started
  • SubscriptionJS
  • REST API
  • Webhooks
  • Code Samples
  • UseCases
  • Request a Demo

›Metered usage components

Introduction

  • Introduction

Contracts

  • Adding contract for new customer
  • Adding contract for existing customer
  • Adding future contract without invoicing
  • Up/-downgrading to a plan variant
  • Terminate a contract with notice
  • Terminate a contract without notice

Components

    Component subscriptions

    • Concept
    • Adding/removing
    • In-/decreasing quantity
    • Override for components

    Metered usage components

    • Concept
    • Bill metered usage
    • Override for metered usage

Discounts

  • Adding discounts
  • Adding discounts via coupon

Miscellaneous

  • Rated items
  • Email Notification Template

Bill metered usage

When registering metered usage with a contract you have to provide a dueDate. Metered usage is billed in regular recurring billings. All unbilled entries with dueDate <= NextBillingDate will be billed in this process. Metered usage will be billed even from previous billing periods, so you can simply post it with the correct DueDate, even if far in the past. If DueDate < LastBillingDate, then the free quota defined in the PlanVariant will we not be considered.

Sample request

POST /Orders

{
  "ContractId": "5e563b344de08409ace88ecb",
  "Cart": {
    "MeteredUsages": [
      {
        "ComponentId": "5cb5c38e4de0842368ea6e32",
        "Quantity": 5
      }
    ],
    "ComponentSubscriptions": [],
    "DiscountSubscriptions": [],
    "RatedItems": [],
    "Quantity": 1
  },
  "ChangeDate": null,
  "TriggerInterimBilling": true,
}

By setting TriggerInterimBilling to "true" all unbilled metered usage entries with DueDate <= current date/time in the contract will be billed instantly.

POST Contracts/{contractId}/usage

{"DueDate":"2020-02-26T09:32:36.123Z","ComponentId":"5cb5c38e4de0842368ea6e32","Quantity":5}

Alternatively metered usage can be posted to a contract without an order. When adding metered usage like this, an interim billing has to be triggered separately, if applicable.

Sample response

{
  "Id": "5e56923d9cc9ba14fc9c1e41",
  "ContractId": "5e563b344de08409ace88ecb",
  "TransferredAt": "2020-02-26T15:43:57.0000000Z",
  "ComponentId": "5cb5c38e4de0842368ea6e32",
  "Quantity": 5,
  "Key": "",
  "DueDate": "2020-02-26T09:32:36.1230000Z"
}
Last updated on 3/17/2020 by Stollemax
← ConceptOverride for metered usage →
Docs
Getting StartedAPI Reference
Resource
Help CenterSupportBlogTutorials
Start with billwerk
Test for free
Request a Demo
Already started?
billwerk Sandboxbillwerk Production
billwerk GmbH
© Made with ❤ in Germany for Europe by billwerk GmbH | 2022
Imprint
|
Data Privacy Rules
|
Disclaimer