Provides payment integration for


Enum where members are also (and must be) ints


get_js_path(→ str)

get_pay_assets(→ Iterator[str])

process_payment(→ Payment | PaymentError | None)

Processes a payment using various methods.

Module Contents

class pay.integration.PayApp[source]

Bases: more.webassets.WebassetsApp

Provides payment integration for onegov.core.framework.Framework based applications.

configure_payment_providers(*, payment_providers_enabled: bool = False, payment_provider_defaults: dict[str, Any] | None = None, **cfg: Any) None[source]

Configures the preconfigured parameters for payment providers.

Takes one dictionary for each availble provider. Available providers can be found in the models/payment_providers folder. Additionally, it is possible to enable/disable custom payment providers for the whole site.

For example:

payment_providers_enabled: true
        client_id: foo
        client_secret: bar

Since multiple payment providers (even of the same type) may exist, and because some information stored on the payment providers need to be configured differently for each application_id (and possibly set up through OAuth) we only provide default parameters.

When we create a new payment provider, these default values may be read by the payment provider.

default_payment_provider()[Any] | None[source]
adjust_price(price: | None) | None[source]

Takes the given price object and adjusts it depending on the settings of the payment provider (for example, the fee might be charged to the user).

pay.integration.get_js_path() str[source]
pay.integration.get_pay_assets() Iterator[str][source]
class pay.integration.PaymentError[source]

Bases: enum.IntEnum

Enum where members are also (and must be) ints

pay.integration.process_payment(method:, price:, provider:[Any] | None = None, token: str | None = None) Payment | PaymentError | None[source]

Processes a payment using various methods.

This method returns one of the following:

  • The processed payment if successful.

  • None if an unknown error occurred.

  • An error code (see below).

Possible error codes:

  • INSUFFICIENT_FUNDS - the card has insufficient funds.

Available methods:

‘free’: Payment may be done manually or by credit card ‘cc’: Payment must be done by credit card ‘manual’: Payment must be done manually