SubscriptionJS.Portal
SubscriptionJS.Portal(selfServiceToken)
upgradePaySync(orderId, success, error)
upgradePayInteractive(subscriptionJSPayment, secretPaymentData, order, success, error)
upgradePayInteractive(null, paymentForm, order, success, error)
invoicePdfDownloadUrl(invoice)
contractDetails(success, error)
contractCancel(success, error)
customerChange(customerData, success, error)
paymentChange(subscriptionJSPayment, secretPaymentData, success, error)
paymentChange(null, paymentForm, success, error)
SubscriptionJS.Portal(selfServiceToken)
Constructor. Creates an instance of SubscriptionJS.Portal.
Property | Type | Description |
---|---|---|
selfServiceToken | string | A token to identify and authenticate a customer. You can request this token from the API via GET /api/v1/contracts/{contractId}/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.
Property | Type | Description |
---|---|---|
orderId | string | Id of an order to pay for. The order must have been created before using a backend API call. |
upgradePaySync success
{
"OrderId": "5ca5d0fd12a50c79c94f46f0",
"ContractId": "5ca4b04a50abb730802f9e78",
"CustomerId": "5ca4b04a50abb730802f9e77",
"GrossTotal": 387.6,
"OrderStatus": "PaymentPending"
}
upgradePaySync error
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.
Property | Type | Description |
---|---|---|
subscriptionJSPayment | SubscriptionJS.Payment | An instance of SubscriptionJS.Payment . |
secretPaymentData | secretPaymentData | The potentially secret payment information entered by the customer to pay for the order. |
order | order | An order object previously created either via SubscriptionJS.Signup.createOrder() or via a backend call or via the billwerk user interface. Must look like { OrderId : "(id)", GrossTotal : 23.4, Currency : "EUR" } |
upgradePayInteractive success
{ "OrderId": "5ca4af02bb573feacc9f7b55", "ContractId": "5ca4af0250abb730802f9e3e", "CustomerId": "5ca4af0250abb730802f9e3d", "GrossTotal": 89.25, "Currency": "EUR", "OrderStatus": "InProgress" }
upgradePayInteractive error
upgradePayInteractive(null, paymentForm, order, success, error)
[paymentForm EXCLUSIVE]
Behaves like upgradePayInteractive, except subscriptionJsPayment
is not necessary and paymentForm
is submitted instead of secretPaymentData
.
invoicePdfDownloadUrl(invoice)
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 will have to route requests through your server or mirror the PDFs proactively. To get a list of invoices for a contract please use the function contractDetails(...)
.
Property | Type | Description |
---|---|---|
invoice | string or invoice object | Either the id of the invoice or an invoice object that has an 'Id' field. A URL string to download the PDF, including the selfServiceToken that is required for authentication. |
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, so that it ends at the next possible point in time given by the cancellation period and minimum contract duration settings.
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.
Property | Type | Description |
---|---|---|
customerData | customerData | An 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.
Property | Type | Description |
---|---|---|
subscriptionJSPayment | SubscriptionJS.Payment | An 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. |
secretPaymentData | SecretPaymentData | Potentially 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
.