Cloud Functions
Overview
Section titled “Overview”Mindhyv calls 14 Firebase Cloud Functions (13 custom + 1 Stripe extension). All custom functions use httpsCallable from Firebase.
import { httpsCallable } from 'firebase/functions';
const fn = httpsCallable(functions, 'functionName');const result = await fn(params);Stripe Product Management (5 functions)
Section titled “Stripe Product Management (5 functions)”createStripeProductCallable
Section titled “createStripeProductCallable”Creates a Stripe product and optional price on a seller’s Connect account.
| Parameter | Type | Description |
|---|---|---|
hubId | string | Hub ID |
portfolioItemId | string | Service/product ID |
name | string | Product name |
description | string | Product description |
price | object | { amount, currency, type } |
accountId | string | Stripe Connect account ID |
metadata | object | Custom metadata (e.g., type: 'service') |
Returns: { success, productId, priceId?, message? }
Called from: Service dialog, product dialog (hub content editors)
updateStripeProductCallable
Section titled “updateStripeProductCallable”Updates an existing Stripe product’s name, description, active status, or image.
Called from: Hub content editors (when editing service/product details)
deleteStripeProductCallable
Section titled “deleteStripeProductCallable”Deletes or archives a Stripe product. Falls back to archiving if delete fails.
createStripePriceCallable
Section titled “createStripePriceCallable”Creates a new Stripe price for an existing product. Supports one_time and recurring types.
updateStripePriceCallable
Section titled “updateStripePriceCallable”Updates or creates Stripe prices. Handles package pricing changes for services.
Called from: Service editor, service packages editor, product pricing editor, product variants editor
Stripe Connect (4 functions)
Section titled “Stripe Connect (4 functions)”createConnectAccountCallable
Section titled “createConnectAccountCallable”Creates a new Stripe Express Connect account for a seller.
| Parameter | Type | Description |
|---|---|---|
userId | string | Firebase user ID |
email | string | User email |
displayName | string | User display name |
country | string | Country code (US or MX) |
Returns: { success, accountLink?, message? }
Called from: Hub payments settings page
getConnectAccountStatusCallable
Section titled “getConnectAccountStatusCallable”Retrieves current Stripe Connect account status and requirements.
| Parameter | Type | Description |
|---|---|---|
accountId | string | Stripe Connect account ID |
Returns: { success, chargesEnabled, payoutsEnabled, status, requirements, alldata }
Called from: Hub payments settings page (on load)
getConnectAccountLinkCallable
Section titled “getConnectAccountLinkCallable”Generates an onboarding/continuation link for Stripe Connect setup.
| Parameter | Type | Description |
|---|---|---|
accountId | string | Stripe Connect account ID |
hubId | string | Hub ID |
returnUrl | string | Return URL after setup |
Returns: { success, accountLink?, message? }
Called from: Hub payments settings page
getConnectLoginLinkCallable
Section titled “getConnectLoginLinkCallable”Generates a Stripe Express dashboard login link.
| Parameter | Type | Description |
|---|---|---|
accountId | string | Stripe Connect account ID |
redirectUrl | string | Redirect URL (optional) |
Returns: { success, url }
Called from: Nav user menu (Stripe dashboard link)
Marketplace (1 function)
Section titled “Marketplace (1 function)”createConnectCheckoutCallable
Section titled “createConnectCheckoutCallable”Creates a Stripe checkout session for marketplace purchases using Direct Charges.
| Parameter | Type | Description |
|---|---|---|
priceId | string | Stripe price ID |
sellerStripeAccountId | string | Seller’s Connect account |
amountInCents | number | Purchase amount |
successUrl | string | Success redirect URL |
cancelUrl | string | Cancel redirect URL |
currency | string | Currency code |
buyerId | string | Buyer’s user ID |
platformFeePercentage | number | Platform fee (0.05 = 5%) |
metadata | object | Order details (serviceId, hubId, packageId, etc.) |
Returns: { sessionId, url, orderId, applicationFeeAmount }
Called from: Order summary component (marketplace checkout flow)
Sync (1 function)
Section titled “Sync (1 function)”syncStripeServiceCallable
Section titled “syncStripeServiceCallable”Syncs service/product details with Stripe, creating product and price records as needed.
| Parameter | Type | Description |
|---|---|---|
hubId | string | Hub ID |
serviceId | string | Service ID |
accountId | string | Stripe Connect account ID |
service | object | Service details |
packages | array | Service packages with pricing |
Returns: { success, productId, createdProduct, basePriceId, packagePrices[], message }
Called from: Service editor, product editor (sync to Stripe button)
Profile (1 function)
Section titled “Profile (1 function)”getUserDataByUsernameCallable
Section titled “getUserDataByUsernameCallable”Retrieves full user profile data by username (used for public profiles).
| Parameter | Type | Description |
|---|---|---|
userName | string | Username to look up |
Returns: { success, userId, userData, testimonials, skills, workExperiences, educations, certifications, projects, socialLinks, ctas }
Called from: Public profile page (/public-profile/[id])
Referrals (1 function)
Section titled “Referrals (1 function)”trackReferralSignupCallable
Section titled “trackReferralSignupCallable”Tracks new user signups via referral codes.
| Parameter | Type | Description |
|---|---|---|
referralCode | string | Referral code used |
userAgent | string | Browser user agent |
ipAddress | string | User IP |
utm_* | string | UTM parameters (source, medium, campaign, term, content) |
userData | object | { email, displayName } |
Returns: { success, referralId?, message? }
Called from: Referral service (trackReferralSignup() on sign-up)
Stripe Extension (1 function)
Section titled “Stripe Extension (1 function)”ext-firestore-stripe-payments-createPortalLink
Section titled “ext-firestore-stripe-payments-createPortalLink”Provided by the Stripe Firestore extension. Creates a Stripe Customer Portal link for subscription management.
| Parameter | Type | Description |
|---|---|---|
returnUrl | string | Return URL after portal |
locale | string | Portal locale |
Returns: { url }
Called from: Nav user menu, account subscription section
Function Categories Summary
Section titled “Function Categories Summary”| Category | Count | Functions |
|---|---|---|
| Stripe Products | 5 | create, update, delete, createPrice, updatePrice |
| Stripe Connect | 4 | createAccount, getStatus, getLink, getLoginLink |
| Marketplace | 1 | createConnectCheckout |
| Sync | 1 | syncStripeService |
| Profile | 1 | getUserDataByUsername |
| Referrals | 1 | trackReferralSignup |
| Extension | 1 | createPortalLink |