← Back to Home

Backend API Documentation

This page gathers all backend API endpoints and front-end responsibilities.

For more details, please refer to the Swagger documentation.

🌐 Internationalization 📦 Products 🛒 Shopping Cart 🔐 Authentication & Users 💳 Orders & Payments 🧾 Invoices & Tickets 🛠️ Administration 🔌 Logout

1. Internationalization

All endpoints support the Accept-Language header for translations.

The supported locales are English (en), German (de), French (fr).

Accept-Language: de

2. Products

2.1 List in-stock products

GET /api/products
(filters & pagination in query)

fetch('/api/products?page=1&per_page=20&category=concert', { headers })
  .then(res => res.json());

2.2 Get product details

GET /api/products/{id}

3. Shopping Cart

3.1 Guest cart

3.1.1 View cart

GET /api/cart

3.1.2 Update item

PATCH /api/cart/item/{product_id}

3.2 User cart

This cart is stored in database. After login, guest cart merges into user’s cart.

All endpoints require

Authorization: Bearer {token}

⚠️ After any update (guest or user), always re-fetch the cart with GET /api/cart.

4. Authentication & Users

4.1 Registration

POST /api/auth/register

4.1.1 Email verification

GET /api/auth/email/{id}/{hash}
Redirects to front URLs:
/verification-result/success
/verification-result/invalid
/verification-result/already-verified
/verification-result/error

⚠️ By problems with verification, please contact administration with the registered email, the admin can verify it.

Email Verification Example

4.2 Login & Two-Factor Authentication

POST /api/auth/login After login, guest cart merges into user’s cart.

⚠️ The Bearer token is valid 12 hours or 7 days when remember me is active.

4.3 Enable/Disable 2FA

⚠️ 2FA is optional but recommended. For help disabling it, please contact administration with your registered email. We use Google 2FA.

4.4 Password reset

Password Reset Example

4.5 Change password

POST /api/auth/password

4.6 Profile & Email change

New Email Verification Example Cancel Email Request Example

5. Orders & Payments

5.1 Initiate payment

POST /api/payments
(Auth) returns → { client_secret }

⚠️ This endpoint is called when the user clicks on the "Pay" button.

5.1.1 Front integration

After receiving client_secret, the front should:

const stripe = await loadStripe('pk_test_...');
const elements = stripe.elements();
const card = elements.create('card');
card.mount('#card-element');
const { error, paymentIntent } = await stripe.confirmCardPayment(clientSecret, { payment_method: { card, billing_details: { name, email } } });

5.2 Stripe webhook

POST /api/payments/webhook

Verify signature and handle events (invoices, tickets, email with tickets, stock updates).

⚠️ The front-end should not call this endpoint directly. It is called by Stripe when a payment is made.

Email Tickets Example

5.3 Status & Clear cart

GET /api/payments/{uuid}

Poll for status until it’s paid.

⚠️ Once paid, front-end must call DELETE /api/cart/items to clear the cart.

5.4 Refund (admin)

POST /api/payments/{uuid}/refund

{ "amount": 25.00 } regenerates the invoice PDF.

⚠️ After refund the admin should update the status of the tickets too, it's not automatically.

6. Invoices & Tickets

6.1 User invoices

6.2 Admin invoice download

GET /api/invoices/admin/{filename}

6.3 User tickets

6.4 Admin tickets

⚠️ Only tickets marked “issued” are valid for scanning.

⚠️ For free tickets, the front-end should call POST /api/tickets with the user_id, locale and quantity. The backend will generate the invoices and the tickets and send them to the user via email.

Invoice Example Ticket Example

7. Administration

7.1 Products management

⚠️ All product data (translations, descriptions, etc.) must be provided for every supported locale.

⚠️ The sale field is a decimal (e.g. 0.10 for 10% discount).

7.2 Users management

⚠️ The user can be deactivated by changing is_active.

7.3 Sales reporting

GET /api/admin/sales (supports filters & pagination)

7.4 Employee account creation

POST /api/users/employees

7.5 Ticket scanning for employees

GET /api/tickets/scan/{token}

After scanning the QR code, the employee calls this endpoint to retrieve the ticket details (customer info, event info, ticket token and current status). The {token} parameter must be the UUID encoded in the QR code.

POST /api/tickets/scan/{token}

⚠️ To validate the ticket and mark it as used, the employee must send the {token} (the UUID that he received by the GET) to this endpoint.

7.6 Payments (admin)

⚠️ The refund is not automatically done on the tickets, the admin must do it manually.

8. Logout

POST /api/auth/logout (Auth) – invalidate token.

← Back to Home
↑ Top