shop.payment_providers.paypal_checkout

Attributes

Classes

PayPalCheckout

PayPal Checkout integration for the ViUR Shop.

Module Contents

shop.payment_providers.paypal_checkout.logger
class shop.payment_providers.paypal_checkout.PayPalCheckout(*, client_id, client_secret, sandbox=False, client_logging_configuration=None, **kwargs)

Bases: shop.payment_providers.PaymentProviderAbstract

PayPal Checkout integration for the ViUR Shop.

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

Parameters:
  • client_id (str)

  • client_secret (str)

  • sandbox (bool)

  • client_logging_configuration (paypalserversdk.logging.configuration.api_logging_configuration.LoggingConfiguration | None | Literal['DEBUG'])

  • kwargs (Any)

name: Final[str] = 'paypal_checkout'
client: paypalserversdk.paypal_serversdk_client.PaypalServersdkClient
get_checkout_start_data(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

dict[str, Any]

checkout(order_skel)

Create an order to start the transaction.

@see https://developer.paypal.com/docs/api/orders/v2/#orders_create

Parameters:

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

Return type:

Any

charge(order_skel, payment=None)
Parameters:
Return type:

tuple[shop.types.SkeletonInstance_T[shop.skeletons.OrderSkel], Any]

check_payment_state(order_skel)
Parameters:

order_skel (viur.core.skeleton.SkeletonInstance)

Return type:

tuple[bool, Any | list[Any]]

return_handler()
webhook(*args, **kwargs)

Webhook for PayPal.

Listens to all events, but handle PAYMENT.CAPTURE.COMPLETED as backup currently only.

get_debug_information(*, order_key=None, payment_id=None)

Get information about a payment / order.

Parameters:
  • order_key (viur.core.db.Key | str | None) – Key of the order skeleton.

  • payment_id (str | None) – PayPal ID of the order / payment.

Return type:

shop.types.JsonResponse[list[dict[str, Any]]]

capture_order(order_key, order_id)

Capture payment for the created order to complete the transaction.

Has to be called by the Frontend after the user has approved the payment.

@see https://developer.paypal.com/docs/api/orders/v2/#orders_capture

Parameters:
  • order_key (str | viur.core.db.Key)

  • order_id (str)

Return type:

shop.types.JsonResponse[dict[str, dict[str, Any]]]

classmethod model_to_dict(obj)

Convert any nested PayPal model to dict representation

Parameters:

obj (Any)

Return type:

Any