-
Notifications
You must be signed in to change notification settings - Fork 155
Description
Sponsor System - Featured Projects + Razorpay Integration
Description
Build a complete sponsor system that allows companies to purchase a single sponsor plan, upload their assets, and get displayed on the landing page and dashboard/home page.
The system must be automated end-to-end using razorpay subscriptions.
Plan
What We Will Build
A sponsor slot system that shows featured projects on:
/landing page (below hero section)/dashboard/home
Components:
- A single sponsor plan purchase flow
- An asset submission form (logo/banner + text + website)
- Automated razorpay webhook handling
- Cloudinary storage for images
- DB storage for sponsor metadata
- Full edge-case handling (failed payment, cancellation, missing assets)
User Flow
- User visits
/sponsorpage - User clicks "become a sponsor" → razorpay subscription checkout for the single plan
- After successful payment → user is redirected to the submission form
- User uploads logo/banner + text + website url
- Backend stores images + metadata
- Sponsor is marked active
- Sponsor appears on:
- Landing page
- Dashboard/home under featured projects
Edge Cases:
- If payment fails or subscription is cancelled → sponsor becomes inactive and is removed
- If user never uploads assets → show a reminder on dashboard until complete
Code Flow
On Payment (Razorpay Checkout)
- Razorpay returns
payment_idandsubscription_id - Backend creates sponsor record with:
plan_status = pending_submissionrazorpay_payment_idrazorpay_sub_id
Submission Form
- User uploads assets
- Images sent to cloudinary → secure url returned
- Backend stores:
- Image url
- Company name
- Description
- Website
- Backend sets
plan_status = active
Webhooks
Handle following razorpay events:
subscription.charged→ mark sponsor activesubscription.pending→pending_paymentsubscription.halted→ unpaid (hide)subscription.cancelled→ cancelled (remove)payment.failed→ failed (remove)
Display Flow
- Landing page fetches sponsors with
plan_status = active - Dashboard/home fetches the same list
- If no sponsors → show "your ad here" placeholder
DB Schema Suggestion
Prisma
model Sponsor {
id String @id @default(cuid())
company_name String
description String
website String
image_url String
razorpay_payment_id String?
razorpay_sub_id String?
plan_status String // active, cancelled, pending_payment, pending_submission, failed
created_at DateTime @default(now())
}
Tasks
Frontend
- Create
/sponsorpage explaining benefits + pricing - Integrate razorpay subscription checkout
- Create submission form for assets
- Build sponsor cards for landing page
- Build sponsor cards for dashboard/home
- Add placeholder for empty slots
Backend
- Create sponsor model
- Cloudinary upload endpoint
- Endpoint to save sponsor data after form submission
- Razorpay subscription integration
- Webhook handler for:
-
subscription.charged -
subscription.pending -
subscription.halted -
subscription.cancelled -
payment.failed
-
- Update sponsor status from webhook events
- Filter active sponsors for both pages
Edge Cases
- User pays but doesn't upload assets → keep reminding
- Payment fails → mark inactive and hide
- Subscription cancelled → auto-remove sponsor
- Image ratio or file invalid → validate
- User submits multiple times → allow updates but store latest
Acceptance Criteria
- After successful payment + asset upload, sponsor automatically appears on landing + dashboard/home
- Cancelled or failed payments immediately remove sponsor
- No admin approval required
- Images stored in cloudinary and metadata stored in db
- Full user flow works smoothly end-to-end
Sub-issues
Metadata
Metadata
Assignees
Labels
No labels