Route charges via on_behalf_of=WKQ on new Stripe platform #508

Open
opened 2026-04-21 02:02:00 +00:00 by forgejo_admin · 0 comments
Contributor

Type

Feature

Lineage

Depends on forgejo_admin/westside-accounting#11 (WKQ Connect activated) and #13 (coaches re-onboarded). Unblocks ISS account drain and archive (westside-accounting#14).

Repo

forgejo_admin/basketball-api

User Story

As a parent paying Westside online, I need my card statement to show WESTSIDE (not PAL-E) and Stripe's 1099-K to correctly name WKQ as the merchant.

Context

Today basketball-api creates PaymentIntents on the platform account (ISS-owned), making ISS the merchant of record. Under the new architecture, Pal Enterprises is the platform and WKQ is the connected merchant — charges must be created with on_behalf_of=<WKQ_account_id> (and typically transfer_data[destination]=<WKQ_account_id> for destination-charge semantics).

Coach compensation continues via transfer calls from the platform, now targeting each coach's NEW Express Connect account ID (mapping established in westside-accounting#13).

File Targets

  • src/basketball_api/stripe_client.py — swap platform API key to new, update charge creation to include on_behalf_of
  • src/basketball_api/routes/checkout.py (or equivalent) — update PaymentIntent creation
  • src/basketball_api/routes/transfers.py (or equivalent) — update coach transfer logic to use new Express account IDs
  • src/basketball_api/webhooks.py — update webhook endpoint secret; register new webhook on new platform

Acceptance Criteria

  • All new charges create with on_behalf_of=<WKQ>
  • Customer card statements show WESTSIDE on next real charge
  • Coach transfers target new Express account IDs
  • Webhook handler accepts events signed by the new platform
  • Tests pass against the new Stripe test-mode keys

Test Expectations

  • Unit tests for charge creation include on_behalf_of assertion
  • Integration test against Stripe test mode with a test WKQ Connect account
  • Run: pytest tests/test_stripe_client.py tests/test_checkout.py -v

Constraints

  • Must preserve all existing metadata on charges (order_id, player_id, parent_email, product_id) — accounting reconciliation depends on it
  • Coach Express account ID mapping comes from westside-accounting#13; do not hardcode old IDs
  • Webhook signing secret must be read from secrets/env, not hardcoded
  • No parent-facing behavior changes — checkout UX stays identical
  • Follow existing route style in basketball-api

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • westside-accounting — entity stack migration
### Type Feature ### Lineage Depends on `forgejo_admin/westside-accounting#11` (WKQ Connect activated) and `#13` (coaches re-onboarded). Unblocks ISS account drain and archive (`westside-accounting#14`). ### Repo `forgejo_admin/basketball-api` ### User Story As a parent paying Westside online, I need my card statement to show `WESTSIDE` (not `PAL-E`) and Stripe's 1099-K to correctly name WKQ as the merchant. ### Context Today basketball-api creates PaymentIntents on the platform account (ISS-owned), making ISS the merchant of record. Under the new architecture, Pal Enterprises is the platform and WKQ is the connected merchant — charges must be created with `on_behalf_of=<WKQ_account_id>` (and typically `transfer_data[destination]=<WKQ_account_id>` for destination-charge semantics). Coach compensation continues via `transfer` calls from the platform, now targeting each coach's NEW Express Connect account ID (mapping established in `westside-accounting#13`). ### File Targets - `src/basketball_api/stripe_client.py` — swap platform API key to new, update charge creation to include `on_behalf_of` - `src/basketball_api/routes/checkout.py` (or equivalent) — update PaymentIntent creation - `src/basketball_api/routes/transfers.py` (or equivalent) — update coach transfer logic to use new Express account IDs - `src/basketball_api/webhooks.py` — update webhook endpoint secret; register new webhook on new platform ### Acceptance Criteria - [ ] All new charges create with `on_behalf_of=<WKQ>` - [ ] Customer card statements show WESTSIDE on next real charge - [ ] Coach transfers target new Express account IDs - [ ] Webhook handler accepts events signed by the new platform - [ ] Tests pass against the new Stripe test-mode keys ### Test Expectations - Unit tests for charge creation include `on_behalf_of` assertion - Integration test against Stripe test mode with a test WKQ Connect account - Run: `pytest tests/test_stripe_client.py tests/test_checkout.py -v` ### Constraints - Must preserve all existing metadata on charges (`order_id`, `player_id`, `parent_email`, `product_id`) — accounting reconciliation depends on it - Coach Express account ID mapping comes from `westside-accounting#13`; do not hardcode old IDs - Webhook signing secret must be read from secrets/env, not hardcoded - No parent-facing behavior changes — checkout UX stays identical - Follow existing route style in basketball-api ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `westside-accounting` — entity stack migration
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/basketball-api#508
No description provided.