SubscriptionJS.Portal(selfServiceToken)Creates an instance of an object

selfServiceToken A token to identify and authenticate a customer. You can request this token from the API via selfServiceToken.

upgradePaySync(orderId, success, error)

Allows the customer to pay for an upgrade using the currently active payment method in a 'synchronous' fashion, i.e. the success method will be called only after the call to the PSP has finished. This method is non-interactive; the user can't change the active payment method using this call. Also, note that this does not require to load client-side payment libraries.

orderIdstringThe unique identifier for the order you wish to pay for. This ID must correspond to an order previously created through a backend API call.

upgradePaySync success

  "OrderId": "5ca5d0fd12a50c79c94f46f0",
  "ContractId": "5ca4b04a50abb730802f9e78",
  "CustomerId": "5ca4b04a50abb730802f9e77",
  "GrossTotal": 387.6,
  "OrderStatus": "PaymentPending"

upgradePayInteractive(subscriptionJSPayment, secretPaymentData, order, success, error)

Allows the customer to pay for an upgrade using new payment data. This method is interactive. Forward user to PSP page if URL is returned.

subscriptionJSPaymentSubscriptionJS.PaymentThis should be an instance of SubscriptionJS.Payment, which contains information about the payment method.
secretPaymentDatasecretPaymentDataThis field is used to pass the confidential payment data entered by the customer, such as credit card numbers or bank account details, required to process the payment.
orderorderThe order object to be paid for. This object should have been created by one of the following methods: SubscriptionJS.Signup.createOrder(), a backend API call, or through the Billwerk+ Transform user interface. It is expected to be structured as follows: { "OrderId" : "order_id_value", "GrossTotal" : numeric_value, "Currency" : "currency_code" }.

upgradePayInteractive success

  "OrderId": "5ca4af02bb573feacc9f7b55", 
  "ContractId": "5ca4af0250abb730802f9e3e",
  "CustomerId": "5ca4af0250abb730802f9e3d",
  "GrossTotal": 89.25,
  "Currency": "EUR",
  "OrderStatus": "InProgress"

upgradePayInteractive(null, paymentForm, order, success, error)

[paymentForm EXCLUSIVE]
It behaves like upgradePayInteractive, except subscriptionJsPayment is unnecessary and paymentForm is submitted instead of secretPaymentData.


Creates a download URL for a PDF document. The URL will point to billwerk, so using this method makes billwerk 'visible' to your customers. If you want to avoid this, you must route requests through your server or mirror the PDFs proactively. To get a list of invoices for a contract, please use the function contractDetails(...).

invoicestring or invoice objectYou can specify either the ID of the invoice as a simple string or pass an entire invoice object. If passing an object, it must include the 'Id' field and a URL string to download the PDF. The URL must contain the selfServiceToken necessary for authentication to secure the transaction.

contractDetails(success, error)

Returns details about the current contract, customer, and payment method. It also lists up to 50 recent invoices.

contractCancel(success, error)

Cancels the contract regularly to end at the next possible point in time given by the cancellation period and minimum contract duration settings.

logout(success, error)

Invalidate self-service token.

customerChange(customerData, success, error)

Changes a customer's data such as name, address or VAT id.

It will be possible to prohibit this method call under Settings -> SubscriptionJS in case you don't want users to be able to change their data without prior verification or if you want to allow data changes only in your system.

Caution! Changing customer data affects all contracts of the customer.

customerDatacustomerDataAn object containing the new customer data. If a field in this object is unset, it will be unset in the customer, too, so this has PUT semantics, not PATCH semantics.

paymentChange(subscriptionJSPayment, secretPaymentData, success, error)

Sets up a new payment method for the contract.

subscriptionJSPaymentSubscriptionJS.PaymentAn instance of SubscriptionJS.Payment that will be used to talk to the payment service provider. At present, the instance must be ready before calling this method.
secretPaymentDataSecretPaymentDataPotentially secret payment data required for the respective payment method, e.g. credit card or direct debit information.

paymentChange(null, paymentForm, success, error)

[paymentForm EXCLUSIVE]
Behaves like paymentChange, except subscriptionJsPayment is not necessary and paymentForm is submitted instead of secretPaymentData.