58ca4e68db
- Go backend API with full CRUD for all modules (CRM, Sales, Finance, HR, Legal, Marketing, Support, Purchase, Inventory, Projects, Automation, Analytics) - Rust analytics service with parallel report generation - C runtime with POSIX shared memory IPC - PostgreSQL schema with 30+ tables, full migrations - Redis cache, sessions, pub/sub - Kafka event streaming with Zookeeper - WebSocket hub for real-time updates - Automation engine with cron jobs, workflows, event triggers - JWT authentication, multi-tenant from start - Docker Compose with all services - Nginx reverse proxy with rate limiting - Integration tests passing - Feature gap analysis against Fortnox/Odoo/Visma Refs: BOC-001
113 lines
3.1 KiB
Markdown
113 lines
3.1 KiB
Markdown
# Stripe Setup för quiXzoom Shop
|
|
|
|
## 1. Skapa Stripe-konto
|
|
|
|
1. Gå till [stripe.com](https://stripe.com)
|
|
2. Skapa konto (eller logga in på befintligt)
|
|
3. Växla till "Test mode" för utveckling
|
|
|
|
## 2. Hämta API-nycklar
|
|
|
|
Gå till **Developers → API keys**:
|
|
|
|
| Nyckel | Miljö | Beskrivning |
|
|
|--------|-------|-------------|
|
|
| `Publishable key` | Test | `pk_test_...` — används i frontend |
|
|
| `Secret key` | Test | `sk_test_...` — används i backend |
|
|
|
|
## 3. Konfigurera Webhook
|
|
|
|
Gå till **Developers → Webhooks**:
|
|
|
|
1. Klicka "Add endpoint"
|
|
2. URL: `https://shop.quixzoom.com/api/payment/webhook`
|
|
3. Välj events:
|
|
- `payment_intent.succeeded`
|
|
- `payment_intent.payment_failed`
|
|
4. Kopiera "Signing secret" (`whsec_...`)
|
|
|
|
## 4. Uppdatera miljövariabler
|
|
|
|
```bash
|
|
sudo systemctl edit --full quixzoom-shop
|
|
```
|
|
|
|
Uppdatera dessa rader:
|
|
```ini
|
|
Environment=STRIPE_SECRET_KEY=sk_test_din_hemliga_nyckel
|
|
Environment=STRIPE_PUBLISHABLE_KEY=pk_test_din_publika_nyckel
|
|
Environment=STRIPE_WEBHOOK_SECRET=whsec_din_webhook_secret
|
|
```
|
|
|
|
För produktion, byt till live-nycklar (`sk_live_`, `pk_live_`):
|
|
```ini
|
|
Environment=STRIPE_SECRET_KEY=sk_live_din_hemliga_nyckel
|
|
Environment=STRIPE_PUBLISHABLE_KEY=pk_live_din_publika_nyckel
|
|
```
|
|
|
|
## 5. Starta om servicen
|
|
|
|
```bash
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl restart quixzoom-shop
|
|
sudo systemctl status quixzoom-shop
|
|
```
|
|
|
|
## 6. Testa betalning
|
|
|
|
Använd Stripe's test-kort:
|
|
|
|
| Kortnummer | CVC | Datum | Resultat |
|
|
|------------|-----|-------|----------|
|
|
| `4242 4242 4242 4242` | Any | Any future | Success |
|
|
| `4000 0000 0000 0002` | Any | Any future | Declined |
|
|
| `4000 0000 0000 9995` | Any | Any future | Insufficient funds |
|
|
|
|
## 7. Produktion
|
|
|
|
Innan du går live:
|
|
|
|
1. ✅ Aktivera Stripe-konto (verifiera företag)
|
|
2. ✅ Byt till live-nycklar
|
|
3. ✅ Sätt upp webhook för produktion
|
|
4. ✅ Konfigurera payout-konto (bankkonto)
|
|
5. ✅ Testa hela flödet med riktiga betalningar i test-mode
|
|
6. ✅ Sätt upp Stripe Connect om du vill dela intäkter
|
|
|
|
## Arkitektur
|
|
|
|
```
|
|
Användare → quiXzoom App/Web → shop.quixzoom.com
|
|
↓
|
|
FastAPI (quixzoom-shop)
|
|
↓
|
|
┌─────────┴─────────┐
|
|
↓ ↓
|
|
PostgreSQL Stripe API
|
|
(ordrar, (betalningar)
|
|
produkter)
|
|
↓
|
|
Redis (cache)
|
|
```
|
|
|
|
## Betalningsflöde
|
|
|
|
1. Användare lägger produkter i kundvagn
|
|
2. Klickar "Gå till kassan"
|
|
3. Backend skapar order (status: `pending`)
|
|
4. Backend skapar Stripe PaymentIntent
|
|
5. Frontend visar Stripe Card Element
|
|
6. Användare fyller i kortuppgifter
|
|
7. Frontend bekräftar betalning med Stripe
|
|
8. Stripe skickar webhook till backend
|
|
9. Backend uppdaterar order till `paid`
|
|
10. Användare ser bekräftelse
|
|
|
|
## Priser
|
|
|
|
Alla priser i databasen är i **öre** (SEK):
|
|
- 129900 = 1 299,00 kr
|
|
- 49900 = 499,00 kr
|
|
|
|
Stripe hanterar alltid öre för SEK.
|