Developer Docs

Developer Docs

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

›Contracts

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

Adding contract for existing customer

To create a contract for an existing customer a somewhat different process is required than creating a new customer altogether, because we have no way of identifying, authenticating or authorizing your customers. Hence, to create a contract for an existing customer, the request must go through your server's backend to the billwerk REST API. However, that separation makes sense because the workflow is usually quite different from an end-user perspective. Re-entering a lot of information seems useless, and the order process usually doesn't involve the public web site's checkout process.

Create order

Sample request

POST /Orders

{
  "TriggerInterimBilling": false,
  "CustomerId": "5e5361659cc9ba118cccc630",
  "Cart": {
    "PlanVariantId": "5e5361659cc9ba118cccc620",
    "InheritStartDate": false,
    "ComponentSubscriptions": [
      {
        "ComponentId": "5e5361659cc9ba118cccc61e",
        "Quantity": 2.0
      }
    ]
  },
  "PreviewAfterTrial": false
}

Sample Response

{
  "Id": "5e5361659cc9ba118cccc631",
  "AllowWithoutPaymentData": true,
  "ComponentSubscriptions": [
    {
      "ComponentType": "QuantityBased",
      "PreventModification": false,
      "VatPercentage": 19.0,
      "TotalNet": 2.0,
      "TotalVat": 0.38,
      "IsQuantityBased": false,
      "ComponentId": "5e5361659cc9ba118cccc61e",
      "Quantity": 2.0
    }
  ],
  "Total": 7.0,
  "TotalVat": 1.33,
  "TotalGross": 0.0,
  "NextTotalGross": 0.0,
  "IsTrial": false,
  "TrialEndPolicy": "NoTrial",
  "Status": "InProgress",
  "OrderType": "Signup",
  "TriggerInterimBilling": false,
  "CustomerId": "5e5361659cc9ba118cccc632",
  "ContractId": "5e5361659cc9ba118cccc605",
  "PreviewAfterTrial": false
}

Commit the order through a payment

The details depend on your payment requirements. If the customer only pays on account or you let him signup without payment data you can also use an API call. In the more common use case where you need to (or at least want to have the option to) collect payment data, we're facing the interactive payment process implemented in SubscriptionJS again.

SubscriptionJS offers a method paySignupInteractive(subscriptionJSPayment, secretPaymentData, order, success, error) that you can use to perform the interactive payment for an order. This method is internally called by SubscriptionJS's subscribe(), too. However, subscribe() also creates the order via JS. Creating orders is one of the few processes that can be performed both via JS and via the REST API.

Last updated on 3/17/2020 by Stollemax
← Adding contract for new customerAdding future contract without invoicing →
  • Create order
    • Sample request
    • Sample Response
  • Commit the order through a payment
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