Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/canton_mcp_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,18 +1413,17 @@ async def create_billing_credit(request: Request):
description=description or "Top-up via billing portal",
)

# Get updated balance
billing = await get_chain_balance(user_party)

logger.info(f"💳 CreditReceipt created: {contract_id} for {user_party} - {amount} CC")

# Intentionally NOT calling get_chain_balance() here. On a busy provider
# party (thousands of charges + credits) it adds ~25–30 round-trips of
# paginated /v2/updates walks (~30s) — long enough to exceed the
# autobot's 30s fetch timeout. Callers that need the post-credit
# balance should hit GET /billing/balance/{party_id} explicitly.
return JSONResponse(content={
"success": True,
"contractId": contract_id,
"amount": amount,
"balance": billing.balance,
"totalCredited": billing.total_credited,
"totalCharged": billing.total_charged,
})

except CantonBillingError as e:
Expand Down
Loading