shop.payment_providers

Submodules

Package Contents

Classes

PaymentProviderAbstract

Abstract base class for all payment providers in the ViUR Shop.

AmazonPay

Amazon Pay integration for the ViUR Shop.

Invoice

Invoice payment method for the ViUR Shop.

PayPalPlus

PayPal Plus integration for the ViUR Shop.

PrePayment

Prepayment method for the ViUR Shop.

Prepayment

Prepayment method for the ViUR Shop.

class shop.payment_providers.PaymentProviderAbstract(*, image_path=None, is_available=None)

Bases: viur.core.prototypes.instanced_module.InstancedModule, viur.core.Module, abc.ABC

Abstract base class for all payment providers in the ViUR Shop.

Provides a standardized interface for implementing different payment methods, including methods for checkout, charging, and handling payment states.

Subclasses must implement the required methods to integrate specific payment providers.

Parameters:
  • image_path (str | None)

  • is_available (shop.types.t.Callable[[shop.types.t.Self, shop.types.SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None], bool] | None)

abstract property name: str

Define the internal name of the payment provider

Return type:

str

property title: viur.core.translate

Define the external title of the payment provider

Return type:

viur.core.translate

property description: viur.core.translate

Define the description of the payment provider

Return type:

viur.core.translate

shop: shop.shop.Shop

Reference to the main Shop instance.

is_available(order_skel)
Parameters:

order_skel (shop.types.SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None)

Return type:

bool

can_checkout(order_skel)

Check if a checkout process can be started

An empty list means not error, a list with errors rejects the checkout start.

Parameters:

order_skel (shop.types.SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None)

Return type:

list[shop.types.ClientError]

abstract checkout(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

shop.types.t.Any

get_checkout_start_data(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

shop.types.t.Any

can_order(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

list[shop.types.ClientError]

abstract charge()
abstract check_payment_state(order_skel)

Check the payment state from the PaymentProvider API/service

Access OrderSkel.is_paid to get the payment state of an order.

Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

tuple[bool, shop.types.t.Any]

abstract return_handler()
abstract webhook()
abstract get_debug_information()
_append_payment_to_order_skel(order_skel, payment=None)

Append payment data to an order

Append payment_provider name and creationdate by default. Write safely in a transaction.

Parameters:
Return type:

shop.types.SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel]

serialize_for_api(order_skel)

Serialize this Payment Provder for the API

Used by Order.get_payment_providers() and Order.payment_providers_list() Can be subclasses to expose more information via API.

Parameters:

order_skel (shop.types.SkeletonInstance_T[viur.shop.skeletons.order.OrderSkel] | None)

Return type:

shop.types.PaymentProviderResult

class shop.payment_providers.AmazonPay(*, mws_access_key, mws_secret_key, merchant_id, client_id, client_secret, region='de', currency_code='EUR', sandbox=False, language='en', **kwargs)

Bases: shop.payment_providers.PaymentProviderAbstract

Amazon Pay integration for the ViUR Shop.

Handles the checkout process using Amazon Pay, including authorization and payment capture. Requires Amazon MWS credentials and configuration parameters.

Parameters:
  • mws_access_key (str) – Amazon MWS access key.

  • mws_secret_key (str) – Amazon MWS secret key.

  • merchant_id (str) – Amazon merchant ID.

  • client_id (str) – Amazon client ID.

  • client_secret (str) – Amazon client secret.

  • region (str) – Region code (default: ‘de’).

  • currency_code (str) – Currency code (default: ‘EUR’).

  • sandbox (bool) – Use sandbox environment (default: False).

  • language (str) – Language code (default: ‘en’).

  • kwargs (Any)

name: Final[str] = 'amazonpay'
checkout(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

Any

get_checkout_start_data(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

Any

charge()
check_payment_state(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

tuple[bool, Any]

return_handler()
webhook()
get_debug_information()
class shop.payment_providers.Invoice

Bases: shop.payment_providers.PaymentProviderAbstract

Invoice payment method for the ViUR Shop.

Allows customers to place orders with the agreement to pay later via invoice. The order can be marked as ready to ship (RTS) immediately but is not considered paid.

Note:

Payment processing (the customer pays this order in the next x days) and verification are handled externally and not within this module.

name: Final[str] = 'invoice'
checkout(order_skel)
Parameters:

order_skel (shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel])

Return type:

None

charge()
Return type:

None

check_payment_state(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

tuple[bool, Any]

return_handler()
webhook()
get_debug_information()
class shop.payment_providers.PayPalPlus

Bases: shop.payment_providers.PaymentProviderAbstract

PayPal Plus integration for the ViUR Shop.

Supports multiple payment methods through PayPal Plus, including PayPal, credit card, and more. Handles the checkout process, payment state checks, and webhook handling for payment updates.

name: Final[str] = 'paypal_plus'
checkout(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

Any

charge()
check_payment_state()
return_handler()
webhook()
get_debug_information()
class shop.payment_providers.PrePayment

Bases: Prepayment

Prepayment method for the ViUR Shop.

Allows customers to place orders with the agreement to pay in advance. The order is marked as ready to ship (RTS) once payment is received.

The customer pays this order in the next x days, shipping will wait.

Note:

Payment receipt verification (The customer pays this order in the next x days, shipping will wait) is handled externally and not within this module.

class shop.payment_providers.Prepayment

Bases: shop.payment_providers.PaymentProviderAbstract

Prepayment method for the ViUR Shop.

Allows customers to place orders with the agreement to pay in advance. The order is marked as ready to ship (RTS) once payment is received.

The customer pays this order in the next x days, shipping will wait.

Note:

Payment receipt verification (The customer pays this order in the next x days, shipping will wait) is handled externally and not within this module.

name: Final[str] = 'prepayment'
checkout(order_skel)
Parameters:

order_skel (shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel])

Return type:

None

charge()
Return type:

None

check_payment_state(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

tuple[bool, Any]

return_handler()
webhook()
get_debug_information()