SubscriptionJS.Payment

Constructor

SubscriptionJS.Payment(paymentConfig, ready, error)

The SubscriptionJS.Payment constructor is used to create an instance to manage the payment process. This instance performs several critical tasks:

  • Loads Payment Methods: It retrieves the payment methods configured for your Billwerk+ Premium & Enterprise account from the server.
  • Initializes Libraries: It loads and initializes any required libraries specific to the Payment Service Providers (PSPs).

Due to the nature of these operations, which involve external server calls and the loading of additional libraries, the construction process can be time-consuming. Therefore, it is essential to:

  • Minimize Calls: Only instantiate SubscriptionJS.Payment once per page to avoid unnecessary delays.
  • Optimize Loading: Ensure that this process is done efficiently by loading it in a part of your webpage where the wait will not negatively impact the user experience, such as during the initial loading of the webpage or just before the payment section is displayed to the user.

Creating an instance of SubscriptionJS.Payment should be handled with care to ensure optimal performance and user experience.

getAvailablePaymentMethods()

Retrieves the payment methods that are configured and activated in your account.

{
  "InvoicePayment": {
    "DefaultPreauthAmount": {
      "BlackLabel": 1
    }
  },
  "PayOne": {
    "CreditCard": true,
    "DirectDebit": true,
    "OnAccount": false,
    "MerchantId": "340xx",
    "AccountId": "386xx",
    "PortalId": "20244xx",
    "Mode": "Test",
    "BankAccountHash": "xxxx9762bb8bcfd2c8dabbd0cc9d8f3be0c287beb67d74ee8417d6fcf0a49518c5b7345b9818d17adc7676205db9xxxx",
    "CreditCardHash": "xxxx67e1ed11406739e3b1d5e8becc99ba48c7b51d82597e3d0503b8cf11e11f05e09bc13588ccf0fa2fe8b670a6xxxx",
    "DefaultPreauthAmount": {
      "CreditCard": 1,
      "Debit": 1
    }
  }
}

getAvailablePaymentMethodEnum()

Returns a list of available payment methods without any details.

[
  "InvoicePayment",
  "CreditCard:PayOne",
  "Debit:PayOne"
]