Vai al contenuto

Billing and mail

My training can be free or paid. Standblatt is free software (AGPL); a server you run yourself can keep everything free, the hosted service charges a small monthly fee.

Mail

Sign-up confirmations, password resets and member plan notices are mails. Set STANDBLATT_SMTP_HOST, STANDBLATT_SMTP_PORT, STANDBLATT_SMTP_USER, STANDBLATT_SMTP_PASSWORD and STANDBLATT_SMTP_FROM, and STANDBLATT_PUBLIC_URL so links point to the public address. Without an SMTP server the mails are written to the log, which is enough for development (make dev starts Mailpit and sends mails there).

Sign-up

STANDBLATT_SIGNUP=true shows Create an account on the login page. Without it, only the admin panel creates accounts; those users can still use My training from the club user menu.

Billing off (default)

With STANDBLATT_BILLING=false every user has full access to My training. No trial, price or subscription is shown.

Billing on

With STANDBLATT_BILLING=true a user has access while one of these holds:

  1. a personal subscription is paid (paid until in the future),
  2. a club pays a seat for the user's confirmed email address,
  3. the trial is running (STANDBLATT_TRIAL_DAYS from sign-up, or from the first visit for older accounts).

Without access, sessions stay readable and exportable; the API answers 402 Payment Required to new or changed sessions, the progress analysis and competition imports.

Paying by invoice

Enter the date in the admin panel under Users → Personal log → set, or for clubs under Clubs → Member plan. Club admins then add their members' email addresses on the member plan page.

Paying online with Stripe

  1. Create a product with a monthly recurring price in Stripe and copy the price ID (price_…). Enable cards and TWINT as payment methods and the customer portal (cancel, update payment method).
  2. Add a webhook endpoint https://<your host>/api/billing/stripe for the events checkout.session.completed, customer.subscription.created, customer.subscription.updated and customer.subscription.deleted; copy its signing secret.
  3. Set STANDBLATT_STRIPE_SECRET_KEY, STANDBLATT_STRIPE_PRICE_ID and STANDBLATT_STRIPE_WEBHOOK_SECRET and restart.

Users then get a Subscribe button that opens Stripe Checkout, and Manage subscription for the Stripe customer portal. The webhook keeps paid until at the end of the paid period plus one day; a cancelled subscription runs until its period ends. Use Stripe's test mode keys on staging.