Add page_config support to SumUp create_checkout

Accept optional page_config parameter to use per-page
SumUp merchant code and API key instead of global config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-18 17:51:35 +00:00
parent 4d00ba3dbe
commit a858e33ca3

View File

@@ -42,8 +42,16 @@ async def create_checkout(
redirect_url: str,
webhook_url: str | None = None,
description: str | None = None,
page_config: Any | None = None,
) -> Dict[str, Any]:
settings = _sumup_settings()
# Per-page SumUp credentials override globals
if page_config and getattr(page_config, "sumup_api_key", None):
settings["api_key"] = page_config.sumup_api_key
if page_config and getattr(page_config, "sumup_merchant_code", None):
settings["merchant_code"] = page_config.sumup_merchant_code
# Use stored reference if present, otherwise build it
checkout_reference = order.sumup_reference or f"{settings['checkout_reference_prefix']}{order.id}"