feat: integrate CREEM web payment for credits purchase

Replace abandoned iOS App Store route with CREEM Merchant of Record
payment integration for web-based credits purchase.

Backend changes:
- Add CreemClient for CREEM API communication
- Add CreemService for checkout creation and webhook handling
- Add creem_transactions table for payment tracking
- Fix webhook payload parsing (id, order.id, customer.id structure)
- Integrate with existing points ledger system

Frontend changes:
- Display dynamic prices from CREEM API
- Support decimal price formatting (e.g., $1.00)
- Add checkout flow with redirect to CREEM hosted page
This commit is contained in:
zl-q
2026-05-11 18:38:21 +08:00
parent 3ff33640f4
commit f07e307e82
25 changed files with 989 additions and 45 deletions
+8
View File
@@ -232,6 +232,13 @@ class AppleIapSettings(BaseModel):
server_api_private_key: SecretStr | None = None
class CreemSettings(BaseModel):
api_key: SecretStr | None = None
webhook_secret: SecretStr | None = None
base_url: str = "https://test-api.creem.io"
success_url: str = ""
def _resolve_env_files() -> list[str]:
"""Resolve env files in order: .env.local overrides .env"""
current = Path(__file__).resolve()
@@ -280,6 +287,7 @@ class Settings(BaseSettings):
agent_runtime: AgentRuntimeSettings = Field(default_factory=AgentRuntimeSettings)
points_policy: PointsPolicySettings = Field(default_factory=PointsPolicySettings)
apple_iap: AppleIapSettings = Field(default_factory=AppleIapSettings)
creem: CreemSettings = Field(default_factory=CreemSettings)
feedback_report: FeedbackReportSettings = Field(
default_factory=FeedbackReportSettings
)