name: bc-payments-configure-academy-stripe description: Use when academy staff need to configure Stripe API keys and webhook secret for their academy; do NOT use for payment method catalog CRUD, subscription cancel/refund, or student card onboarding. requires: []
Skill: Configure Academy Stripe
When to Use
- Use when staff must connect the academy's own Stripe account (secret key, publishable key, webhook signing secret).
- Use before creating a credit-card
PaymentMethod(is_credit_card: true) or before card-based checkout can charge against academy-specific Stripe credentials. - Do NOT use for listing or creating payment methods — use
bc-payments-manage-academy-payment-methods. - Do NOT use for canceling subscriptions, refunds, or saving a student's card (
/v2/payments/card).
Concepts
- Academy payment settings store per-academy Stripe credentials. A
PUTauto-creates the row if it does not exist yet. - Three fields for a fully independent Stripe setup:
stripe_api_key(server charges),stripe_publishable_key(frontend Stripe.js),stripe_webhook_secret(signature verification on incoming events). - Capability:
crud_academy_payment_settings(typically Academy Admin /country_manager). All/academy/routes require theAcademyheader with the academy id. - Publishable key is exposed on a separate public GET for checkout UIs; secret keys are only written via
PUTand echoed in that response. - Webhook URL BreatheCode receives:
POST /v1/monitoring/stripe/webhook. Register this URL in the Stripe Dashboard (external step). - Fallback: if academy keys are empty, the platform may use global Stripe env vars — reseller academies are expected to configure all three fields.
Workflow
- Authenticate staff with
crud_academy_payment_settings. SendAuthorizationandAcademy: <academy_id>. - Save Stripe keys via
PUT /v1/payments/academy/paymentsettingswithstripe_api_keyandstripe_publishable_key(partial body OK). - In Stripe Dashboard, create a webhook endpoint pointing to
https://<api-host>/v1/monitoring/stripe/webhookwith payment lifecycle events (charges and payment intents at minimum). - Copy the signing secret (
whsec_...) from Stripe andPUTit asstripe_webhook_secreton the same endpoint. - Verify publishable key exposure:
GET /v1/payments/academy/publishable-key?academy=<id>must return200with a non-emptystripe_publishable_key. - If staff also need a credit-card checkout option, hand off to
bc-payments-manage-academy-payment-methods(Path A) — only after Step 5 passes. Do notPOSTis_credit_card: truepayment methods before publishable-key verification succeeds.
Endpoints
Update academy Stripe credentials
- Method / path:
PUT /v1/payments/academy/paymentsettings - Headers:
Authorization: Token <token>,Academy: <academy_id>, optionalAccept-Language: en|es - Permissions:
crud_academy_payment_settings - Pagination: N/A (single resource update; no GET list on this route)
- Body: all fields optional; only send fields to change
Request example (partial — Stripe only):
{
"stripe_api_key": "sk_live_51PxAbCexampleSecretKey",
"stripe_publishable_key": "pk_live_51PxAbCexamplePublishableKey",
"stripe_webhook_secret": "whsec_exampleSigningSecretFromStripe"
}
Response 200:
{
"stripe_api_key": "sk_live_51PxAbCexampleSecretKey",
"stripe_webhook_secret": "whsec_exampleSigningSecretFromStripe",
"stripe_publishable_key": "pk_live_51PxAbCexamplePublishableKey",
"coinbase_api_key": null,
"coinbase_webhook_secret": null
}
Optional body fields also accepted: coinbase_api_key, coinbase_webhook_secret (Coinbase Commerce; not required for Stripe-only setup).
Verify publishable key (public)
- Method / path:
GET /v1/payments/academy/publishable-key?academy=<academy_id> - Headers: none required (
AllowAny). Query parameteracademyis required (or useAcademyheader per API convention). - Pagination: N/A
Response 200:
{
"academy_id": 55,
"academy_name": "Miami Academy",
"academy_slug": "miami",
"stripe_publishable_key": "pk_live_51PxAbCexamplePublishableKey"
}
Use this response in Step 5 as the gate before credit-card payment method creation.
Stripe webhook receiver (register in Stripe Dashboard)
- Method / path:
POST /v1/monitoring/stripe/webhook - Configured in: Stripe Dashboard → Developers → Webhooks (external; not a BreatheCode staff API call)
- Purpose: Stripe sends signed events; BreatheCode verifies using
stripe_webhook_secret(academy-specific when identifiable from the charge, else global fallback)
Edge Cases
- 403 missing capability or Academy header: ensure
crud_academy_payment_settingsandAcademy: <id>onPUT. - 404 on publishable-key GET (
payment-settings-not-foundorpublishable-key-not-configured): settings row missing orstripe_publishable_keyempty — complete Steps 2–4 before handing off to payment methods. - No GET for payment settings: confirm saved values from the
PUTresponse body only. - Translated errors: send
Accept-Language: enoreson staff endpoints for localized error messages. - Staff asks for credit card checkout but Stripe incomplete: stop; finish this skill through Step 5, then load
bc-payments-manage-academy-payment-methodsPath A.
Checklist
stripe_api_key,stripe_publishable_key, andstripe_webhook_secretsaved viaPUT.- Webhook endpoint registered in Stripe pointing to
/v1/monitoring/stripe/webhook. GET /v1/payments/academy/publishable-key?academy=<id>returns200with non-emptystripe_publishable_key.- If credit-card catalog is needed, hand off to
bc-payments-manage-academy-payment-methodsPath A.
Next steps
After Stripe is connected, load bc-payments-manage-academy-payment-methods to set main_currency (if needed), create payment method catalog entries, and follow that skill's Next steps for services, plans, and courses.