Inspiration

Every friend group has one: the planner friend. You're in charge of booking the hotel, the flights, or concert tickets. You shell out hundreds of dollars on your own card, and then begins the painful, awkward dance of chasing people down for e-transfers for weeks.

Buy Now, Pay Later (BNPL) services like Klarna split your payments across time. We built SunPay to split payments across people - ensuring the merchant gets paid in full instantly, while the group organizer never has to carry the financial burden upfront or act as a debt collector again.


Use Cases

Group Travel & Accommodations: You're organizing a bachelorette party. You’re tasked with booking a Mexico resort for 12 bridesmaids. You click "reserve," and suddenly your personal credit card limit is completely maxed out for the month while you wait weeks to get your money back.

High-Demand Concert Tickets: You want to secure 6 seats in the same row for a high-demand concert. If everyone tries to buy their own ticket separately, you risk getting scattered across the venue or missing out entirely - forcing one person to buy the whole block instantly before it sells out.

Flight-Booking: Everyone wants to be on the same flight, but flight prices spike the second multiple people start searching. One person has to bite the bullet and book all the flights at once to lock in the rate, taking on a massive financial burden.


What it does

SunPay is a split-payment group engine.

Instead of one person fronting the entire cost, SunPay integrates directly into a merchant's checkout. Click click ⚡ Split with SunPay. One person initiates the purchase for the group, every member is automatically charged their exact share from a card saved on file, and the merchant is paid in full instantly.

  • Pre-Authorized Allocation: Every group member links a card to a unified group workspace.

  • Instant Settlement: When the organizer checks out on a partner site, SunPay instantly processes every individual's multi-way share simultaneously, paying the merchant in full, live at the point of sale.

  • Automated Advances: If a single card fails, our engine covers the difference instantly so the group booking succeeds, and collects the balance from the user within 30 days.

🔄 End-to-End

Before a high-demand Coldplay ticket sale drops, 3 friends create SunPay accounts via Auth0, securely link cards via Stripe, and join a unified "Coldplay" group space where everyone sets a spending cap.

Anthony gets through the online ticket queue and places 3 tickets worth $700.00 in her cart. At checkout, he clicks ⚡ Split with SunPay, redirects to our platform, selects the group, and authorizes the purchase.

SunPay splits the total evenly. Everyone's cards clear successfully, but Gabriel's card declines. Instead of timing out and losing the tickets, SunPay steps in and pays for Gabriel's unpaid portion. The ticketing merchant is paid the full $700.00 instantly, and the order is confirmed.

Gabriel logs into her individual SunPay dashboard, views his open balance, and pays SunPay for the amount he owes us.


How we built it

SunPay is built with a separate, two-process architecture running entirely locally to simulate a production-grade merchant integration.

  • The Core App: Engineered using Next.js 15 (App Router), TypeScript, Tailwind CSS, and shadcn/ui. Data persistence is managed via raw SQL transactions on SQLite (better-sqlite3) to power a strict, deterministic double-entry accounting ledger. This ensures every card charge, advance, and repayment is fully balanced and auditable.

  • The Merchant Demo: A standalone Express application representing a live storefront (e.g., "TicketMaster"). It executes secure handoffs to SunPay via custom cryptographic URL signatures (HMAC), automatically updating its order state when it receives verified server-to-server callbacks from our payment engine.

API Integrations

  • Auth0 API (Identity, Session Management & Step-Up MFA): Security is paramount when an application has direct authority to pull funds from multiple users' wallets simultaneously. We integrated Auth0 as our primary identity gateway and authorization layer to enforce end-to-end user provisioning, secure session management, and deterministic route protection. Upon user onboarding via Auth0 Universal Login, our backend securely extracts the token claims to instantly provision internal user profiles within our database. To maintain a frictionless user experience, we avoid forcing multi-factor authentication during standard logins. Instead, we engineered a dynamic Step-Up MFA mechanism triggered directly by financial risk thresholds. When an organizer initiates a checkout, the core engine evaluates the total transaction size against a strict backend threshold (STEP_UP_THRESHOLD_CENTS set at $500.00). If the group split crosses this amount, the server intercepts the payload, inspects the session's amr (Authentication Methods Reference) claims, and seamlessly redirects the client to complete an extra TOTP verification challenge directly through Auth0. The cryptographic checkout execution loop is strictly blocked until Auth0 verifies the elevated authentication status, ensuring high-value group bookings cannot be compromised.

  • Stay22 API: Powers an in-app accommodation discovery portal. It handles live location queries completely on our backend, caching results to preserve performance and keep API credentials entirely hidden from the browser.

  • Stripe API (Test Mode): Utilizes SetupIntents to tokenize and save member cards on file. Split checkouts are executed sequentially via off-session PaymentIntents protected by precise idempotency keys to completely prevent double-charging.


Challenges we ran into

Our primary architectural obstacle was tackling default risk: If our engine advances funds for a failing card, how do we protect the platform from carrying bad debt? We mitigated this by introducing a dual-revenue business model:

  • Stay22 Affiliate Revenue: Our in-app travel search lets groups look up real-world accommodations that fit their exact capacity and dynamically filters out options exceeding member caps. Bookings completed through this Stay22 path route affiliate commission revenue directly back to SunPay. We capitalize our short-term advance engine using these affiliate earnings, creating a self-funding safety buffer that offsets default risks.
  • Late Interest Revenue: To further disincentivize defaults and protect our operational margins, any outstanding advanced balances remaining past the standard 30-day window accumulate fixed interest rates.

What we learned

  • Double-Entry Ledger Design: We learned that storing a static account_balance integer inside a database table is an anti-pattern for transaction integrity. Building a true financial engine forced us to treat our database strictly as an immutable log of movements, where a user's financial state is always calculated as the deterministic mathematical sum of their historical actions.
  • Idempotency Over Defensiveness: Leveraging Stripe's native server-side idempotency keys taught us how to design bulletproof API interactions. By formatting keys as unique strings tied directly to specific transaction components—such as {splitId}:{obligationId}—we discovered how to guarantee exactly-once execution safety, ensuring network dropouts mid-request can never result in a user being double-charged.
  • Off-Session Stripe Mechanics: Moving from basic front-end payment forms to advanced backend tokenization opened our eyes to the nuances of off-session processing. We learned how to securely capture a card utilizing SetupIntents during a frictionless user onboarding flow, and then programmatic pull funds later asynchronously via PaymentIntents when an organizer initiates a group checkout.
  • The Affiliate Link Ecosystem: Exploring travel and ticketing APIs like Stay22 introduced us to the engineering mechanics of the affiliate industry. We learned how to build server-side proxies to abstract away complex metadata queries, map physical availability data cleanly into custom data structures, and securely handle tracking links entirely on our backend to keep sensitive developer keys isolated from the client-side browser.

What's next for SunPay

  • Ticketmaster Integration: We plan to scale our budgeting logic from accommodations to live entertainment by integrating with the Ticketmaster Discovery API. This will allow groups to search for upcoming events right inside their SunPay workspace, dynamically matching live ticket availability against the group's collective budgets and seating preferences before checking out. Plus, this unlocks a secondary stream of ticket affiliate revenue to help fund our advance engine.
  • Dynamic Float Underwriting: Implementing a credit-scoring layer that assesses a user's eligibility for payment advances.
  • Merchant SDK Plug-ins: Packaging our sdk.js file into an easy-to-install plugin to bring split-payment mechanics to any online platform.
  • Installment Plans: Allowing users to pay in installments.

Built With

Share this project:

Updates