E8: Payment Processing - Tasks¶
Epic: E8: Payment Processing
E8-F1: Stripe Integration¶
Feature: E8-F1: Stripe Integration
Implementation Note
Stripe checkout is already implemented in the HNS mobile app. The ticketing system needs webhook integration only.
| Status | Task | Verification |
|---|---|---|
| Install Stripe SDK | Package installed | |
| Configure Stripe API key from environment (STRIPE_API_KEY, STRIPE_WEBHOOK_SECRET) | Keys loaded | |
| Implement webhook endpoint /webhooks/stripe | Endpoint reachable | |
| Verify webhook signature | Invalid signature rejected | |
| Implement webhook handler for payment_intent.succeeded | Payment success processed | |
| Implement webhook handler for payment_intent.payment_failed | Payment failure handled | |
| Implement refund API call | Refund succeeds |
E8-F2: Service Fee Calculation¶
Feature: E8-F2: Service Fee Calculation
| Status | Task | Verification |
|---|---|---|
| Add ticket_fee_percentage to Match config (default 6%) | Config saved | |
| Calculate ticket_amount = quantity * unit_price | Calculation correct | |
| Calculate fee_amount = ticket_amount * fee_percentage | Calculation correct | |
| Calculate VAT based on match type (HOME=5%, AWAY=0% for tickets; HOME=25%, AWAY=0% for fees) | VAT correct |
E8-F3: Refund Processing¶
Feature: E8-F3: Refund Processing
| Status | Task | Verification |
|---|---|---|
| Implement POST /admin/orders/{id}/refund endpoint | Initiates refund | |
| Refund ticket_amount only (not fee) | Refund amount excludes fee | |
| Call Stripe refund API | Stripe refund created | |
| Create credit note via e-racuni API | Credit note created | |
| Update ticket status to REFUNDED | Status changed |
E8-F4: Deferred Payment Offer Generation¶
Feature: E8-F4: Deferred Payment Offer Generation
| Status | Task | Verification |
|---|---|---|
| Implement POST /admin/payment-offers endpoint | Creates offer | |
| Group multiple order_ids for same debtor | Orders grouped | |
| Call e-racuni API to create payment offer | e-racuni_id returned | |
| Store e-racuni reference in PaymentOffer table | Reference saved |
E8-F5: E-Racuni Integration¶
Feature: E8-F5: E-Racuni Integration
| Status | Task | Verification |
|---|---|---|
| Install/configure e-racuni API client | Client initialized | |
| Configure credentials from environment (ERACUNI_USERNAME, ERACUNI_PW, ERACUNI_TOKEN) | Credentials loaded | |
| Implement createPaymentOffer API call | Offer created in e-racuni | |
| Implement issueInvoice API call | Invoice issued | |
| Implement createCreditNote API call | Credit note created | |
| Implement status polling for invoice lifecycle | Status updates received |
Last Updated: January 2026