{"openapi":"3.1.0","info":{"title":"POST /api/v1/credit/cards/stripe-issuing/setup","version":"1.0.0","description":"Activate Stripe Issuing capability, ToS, webhooks, and default cardholder"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/cards/stripe-issuing/setup":{"post":{"tags":["credit"],"summary":"Activate Stripe Issuing capability, ToS, webhooks, and default cardholder","description":"Submits missing Stripe Issuing `business_profile` fields (`annual_revenue`, `estimated_worker_count`), records `settings.card_issuing.tos_acceptance`, requests the `card_issuing` capability, subscribes `/api/v1/webhooks/stripe` to all `issuing_*` events, and optionally creates a default `Cardholder` (`ich_...`) on an owned credit program. Live business operator action (an API token receives `403`); sandbox businesses are refused before Stripe calls. Defaults to the business connection. Platform access and platform webhook changes require a signed-in superuser.","operationId":"setup_stripe_issuing","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditStripeIssuingSetupRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CreditStripeIssuingStatusResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"setup_stripe_issuing_api_v1_credit_cards_stripe_issuing_setup_post"}}},"components":{"schemas":{"CreditStripeIssuingSetupRequest":{"properties":{"stripe_account_id":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Stripe Account Id","description":"Owned Stripe account ID (`acct_...`); defaults to the business's canonical Stripe connection. Other accounts require Stripe metadata proving business and credit-line ownership. `platform`, or fallback when no business connection exists, requires a signed-in platform superuser; API tokens cannot use it."},"annual_revenue_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Annual Revenue Cents","description":"Preceding fiscal year gross annual revenue in cents (`business_profile.annual_revenue.amount`)."},"annual_revenue_currency":{"type":"string","maxLength":8,"title":"Annual Revenue Currency","description":"Currency code for `annual_revenue_cents` (`business_profile.annual_revenue.currency`).","default":"usd"},"fiscal_year_end":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Fiscal Year End","description":"Fiscal year end date (`YYYY-MM-DD`) for `business_profile.annual_revenue.fiscal_year_end`; omitted from the Stripe update when not provided."},"estimated_worker_count":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Estimated Worker Count","description":"Estimated worker count (`business_profile.estimated_worker_count`)."},"accept_tos":{"type":"boolean","title":"Accept Tos","description":"Record acceptance of the Stripe Issuing terms of service (`settings.card_issuing.tos_acceptance`).","default":false},"tos_ip":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Tos Ip","description":"IP address to record for Issuing ToS acceptance; defaults to the caller's request IP."},"request_card_issuing":{"type":"boolean","title":"Request Card Issuing","description":"Request the `card_issuing` capability on the Stripe account.","default":true},"configure_webhooks":{"type":"boolean","title":"Configure Webhooks","description":"Subscribe the platform's enabled `/api/v1/webhooks/stripe` endpoints to Issuing events. Applied only for signed-in platform superusers; skipped for ordinary business operators.","default":true},"create_default_cardholder":{"type":"boolean","title":"Create Default Cardholder","description":"Create a default company `Cardholder` (`ich_...`) and bind it to `program_id`.","default":false},"program_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Program Id","description":"Owned credit program ID to store `default_cardholder_id` on; required when create_default_cardholder is true. Any supplied program is checked for business ownership before Stripe mutations."},"cardholder_name":{"anyOf":[{"type":"string","maxLength":24},{"type":"null"}],"title":"Cardholder Name","description":"Display name (up to 24 chars) for the default Stripe Cardholder."},"billing_address":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Billing Address","description":"Billing address (`line1`, `city`, `state`, `postal_code`, `country`) for the created Cardholder."}},"additionalProperties":false,"type":"object","title":"CreditStripeIssuingSetupRequest","description":"Live-business operator setup for an owned Stripe account.\n\nSandbox businesses are refused before provider calls. Platform account\naccess and platform webhook changes require a signed-in superuser."},"CreditStripeIssuingStatusResponse":{"properties":{"configured":{"type":"boolean","title":"Configured","description":"Whether STRIPE_API_KEY is configured in the environment."},"livemode":{"type":"boolean","title":"Livemode","description":"True when the configured Stripe API key is a live-mode key (`sk_live_...`)."},"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Id","description":"Stripe account ID (`acct_...`) inspected."},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name","description":"Business profile or dashboard display name on the Stripe account."},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country","description":"Two-letter country code of the Stripe account."},"card_issuing_capability":{"type":"string","title":"Card Issuing Capability","description":"Status of the `card_issuing` capability (`active`, `pending`, `inactive`, `unrequested`).","default":"unrequested"},"transfers_capability":{"type":"string","title":"Transfers Capability","description":"Status of the `transfers` capability (`active`, `pending`, `inactive`, `unrequested`).","default":"unrequested"},"issuing_api_accessible":{"type":"boolean","title":"Issuing Api Accessible","description":"Whether `stripe.issuing.Cardholder.list` and `stripe.issuing.Card.list` succeed on this account.","default":false},"funding_credit_beta_enabled":{"type":"boolean","title":"Funding Credit Beta Enabled","description":"Whether the Stripe Issuing Credit (`issuing_credit_beta=v1`) Charge Card feature is enabled.","default":false},"tos_accepted":{"type":"boolean","title":"Tos Accepted","description":"Whether `settings.card_issuing.tos_acceptance` has a recorded acceptance timestamp.","default":false},"issuing_balance_available_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Issuing Balance Available Cents","description":"Available balance in the Stripe Issuing funding balance, in integer cents."},"issuing_balance_currency":{"type":"string","title":"Issuing Balance Currency","description":"Three-letter currency code of the Stripe Issuing balance.","default":"USD"},"currently_due_requirements":{"items":{"type":"string"},"type":"array","title":"Currently Due Requirements","description":"Stripe capability onboarding fields currently due to activate `card_issuing`."},"past_due_requirements":{"items":{"type":"string"},"type":"array","title":"Past Due Requirements","description":"Stripe capability onboarding fields past due for `card_issuing`."},"disabled_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Disabled Reason","description":"Reason Stripe reports when `card_issuing` is not yet active."},"webhook_configured":{"type":"boolean","title":"Webhook Configured","description":"Whether an active `/api/v1/webhooks/stripe` endpoint is subscribed to all required `issuing_*` events.","default":false},"missing_webhook_events":{"items":{"type":"string"},"type":"array","title":"Missing Webhook Events","description":"Required `issuing_*` webhook events not yet enabled on `/api/v1/webhooks/stripe`."},"cardholder_count_sample":{"type":"integer","title":"Cardholder Count Sample","description":"Sample count of Stripe Issuing cardholders (`ich_...`) on the account (up to 5).","default":0},"card_count_sample":{"type":"integer","title":"Card Count Sample","description":"Sample count of Stripe Issuing cards (`ic_...`) on the account (up to 5).","default":0},"ready_for_issuing":{"type":"boolean","title":"Ready For Issuing","description":"True when `issuing_api_accessible` is true and `card_issuing_capability` is `active`.","default":false},"ready_for_funding_credit":{"type":"boolean","title":"Ready For Funding Credit","description":"True when both `ready_for_issuing` and `funding_credit_beta_enabled` are true.","default":false},"next_steps":{"items":{"type":"string"},"type":"array","title":"Next Steps","description":"Actionable items required to finish activating or funding Stripe Issuing."}},"type":"object","required":["configured","livemode"],"title":"CreditStripeIssuingStatusResponse","description":"Live inspection of the Stripe account's Issuing capabilities, balance, and webhook subscriptions."},"SuccessEnvelope_CreditStripeIssuingStatusResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/CreditStripeIssuingStatusResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CreditStripeIssuingStatusResponse]"},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}