MemberStripe

Reference for the MemberStripe module: every class and function, with its full signature, parameters and return type. Stripe Connect onboarding for members, one-time dashboard login links, webhook handling that syncs account state, and the per-member Stripe info record.

This page is a pure reference. Each public class is listed below with its functions in alphabetical order; the primary class comes first, then the rest alphabetically.

Classes

MemberStripe

The module's entry class. Registers the HTTP endpoints the Stripe Connect flow needs.

Functions

Route

MemberStripe::Route(): void

Register the module's HTTP endpoints under the member-stripe route directory: the Stripe webhook, the onboarding refresh and return targets, and the dashboard redirect.

Returns void

MemberStripeConnectService

Stripe Connect operations for a member: creating or refreshing the connected account, generating onboarding links, generating a dashboard login link, and building the Stripe client. Stripe API failures are rethrown as an Exception.

BeginConnectOnboarding

MemberStripeConnectService::BeginConnectOnboarding(int $memberId, string $optionalRedirectUrl = ''): string

Ensure a Connect account exists and return a fresh onboarding link for the member.

NameTypeDescription
$memberIdintThe member to onboard.
$optionalRedirectUrlstringWhere the app should land after Stripe returns; empty for none.

Returns string The onboarding URL.

MemberStripeConnectService::CreateDashboardLoginLink(int $memberId): string

Create a one-time Stripe dashboard login link for a member's connected account and persist it with a one hour expiry.

NameTypeDescription
$memberIdintThe member whose connected account is used.

Returns string The dashboard login URL.

MemberStripeConnectService::CreateOnboardingLink(int $memberId, string $optionalRedirectUrl = ''): string

Generate an onboarding URL for a member's Connect account and persist the URL and its expiry. The return and refresh URLs are built from the Web site URL and the module's routes.

NameTypeDescription
$memberIdintThe member whose account the link is for.
$optionalRedirectUrlstringAppended to the return URL so the app controls where the user lands; empty for none.

Returns string The onboarding URL.

CreateStripeConnectAccount

MemberStripeConnectService::CreateStripeConnectAccount(int $memberId): void

Ensure a Stripe Connect account exists for the member, creating one with prefilled identity when needed or refreshing the stored state from Stripe when it already exists.

NameTypeDescription
$memberIdintThe member to create or refresh the account for.

Returns void

stripeClient

MemberStripeConnectService::stripeClient(): \Stripe\StripeClient

Build a Stripe client using the configured secret key.

Returns \Stripe\StripeClient A Stripe client instance.

MemberStripeInfoData

The per-member Stripe info record as a readonly data object: account references, verification and capability flags, cached onboarding and dashboard links with their expiries, and timestamps.

__construct

new MemberStripeInfoData(int $id = 0, int $memberId = 0, string|null $customerRef = null, string|null $connectAccountRef = null, string|null $defaultPaymentMethodRef = null, CalendarDateTimeData|null $onboardingCompletedAt = null, bool $emailVerified = false, bool $identityVerified = false, bool $externalAccountAdded = false, bool $tosAccepted = false, bool $chargesEnabled = false, bool $payoutsEnabled = false, string|null $lastOnboardingUrl = null, CalendarDateTimeData|null $lastOnboardingUrlExpiresAt = null, string|null $lastDashboardUrl = null, CalendarDateTimeData|null $lastDashboardUrlExpiresAt = null, CalendarDateTimeData|null $lastSyncedAt = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData())

Construct a member Stripe info data object.

Returns MemberStripeInfoData

Properties

PropertyTypeDescription
$info->idintThe row primary id (readonly).
$info->memberIdintThe member the record belongs to (readonly).
$info->customerRefstring|nullThe Stripe customer reference, or null (readonly).
$info->connectAccountRefstring|nullThe Stripe Connect account reference, or null (readonly).
$info->defaultPaymentMethodRefstring|nullThe default payment method reference, or null (readonly).
$info->onboardingCompletedAtCalendarDateTimeData|nullWhen onboarding completed, or null (readonly).
$info->emailVerifiedboolWhether the email is verified (readonly).
$info->identityVerifiedboolWhether identity is verified (readonly).
$info->externalAccountAddedboolWhether an external account has been added (readonly).
$info->tosAcceptedboolWhether the terms of service are accepted (readonly).
$info->chargesEnabledboolWhether charges are enabled (readonly).
$info->payoutsEnabledboolWhether payouts are enabled (readonly).
$info->lastOnboardingUrlstring|nullThe last cached onboarding URL, or null (readonly).
$info->lastOnboardingUrlExpiresAtCalendarDateTimeData|nullWhen the cached onboarding URL expires, or null (readonly).
$info->lastDashboardUrlstring|nullThe last cached dashboard URL, or null (readonly).
$info->lastDashboardUrlExpiresAtCalendarDateTimeData|nullWhen the cached dashboard URL expires, or null (readonly).
$info->lastSyncedAtCalendarDateTimeData|nullWhen the record was last synced with Stripe, or null (readonly).
$info->createdAtCalendarDateTimeDataWhen the record was created (readonly).

MemberStripeInfoDatabase

Reads and writes the member_stripe_info row and maps it to and from MemberStripeInfoData. Covers lookups by member, id or connect account reference, upserting the account reference, and updating links and capability flags.

fromRow

MemberStripeInfoDatabase::fromRow(stdClass $row): MemberStripeInfoData

Construct a data object from a database row.

NameTypeDescription
$rowstdClassThe database row.

Returns MemberStripeInfoData The mapped data object.

GetById

MemberStripeInfoDatabase::GetById(int $id): MemberStripeInfoData

Get a record by its primary id.

NameTypeDescription
$idintThe row primary id.

Returns MemberStripeInfoData The record.

GetOptionalByConnectAccountRef

MemberStripeInfoDatabase::GetOptionalByConnectAccountRef(string $connectAccountRef): MemberStripeInfoData|null

Get the record for a Stripe Connect account reference, or null when none matches.

NameTypeDescription
$connectAccountRefstringThe Stripe Connect account reference.

Returns MemberStripeInfoData|null The record, or null.

GetOptionalByMemberId

MemberStripeInfoDatabase::GetOptionalByMemberId(int $memberId): MemberStripeInfoData|null

Get the latest Stripe info record for a member, or null when none exists.

NameTypeDescription
$memberIdintThe member to look up.

Returns MemberStripeInfoData|null The record, or null.

MemberStripeInfoDatabase::UpdateDashboardLink(int $memberId, string $url, int $expiresAt): void

Update the cached dashboard login link URL and its expiry for a member.

NameTypeDescription
$memberIdintThe member whose record is updated.
$urlstringThe dashboard login URL.
$expiresAtintThe expiry as a unix timestamp.

Returns void

UpdateFlagsById

MemberStripeInfoDatabase::UpdateFlagsById(int $id, bool $chargesEnabled, bool $payoutsEnabled, bool $tosAccepted, bool $externalAccountAdded, bool $detailsSubmitted): void

Update the Stripe capability flags for a row by primary id, setting the onboarding completed timestamp when details were submitted.

NameTypeDescription
$idintThe row primary id.
$chargesEnabledboolWhether charges are enabled.
$payoutsEnabledboolWhether payouts are enabled.
$tosAcceptedboolWhether the terms of service are accepted.
$externalAccountAddedboolWhether an external account has been added.
$detailsSubmittedboolWhether account details were submitted.

Returns void

UpdateFromStripeAccountByMemberId

MemberStripeInfoDatabase::UpdateFromStripeAccountByMemberId(int $memberId, \Stripe\Account $acc): void

Update a member's record from a Stripe Account object, deriving the capability, terms, external account, identity and email flags.

NameTypeDescription
$memberIdintThe member whose record is updated.
$acc\Stripe\AccountThe Stripe Account object to read state from.

Returns void

MemberStripeInfoDatabase::UpdateOnboardingLink(int $memberId, string $url, int $expiresAt): void

Update the onboarding link URL and its expiry for a member.

NameTypeDescription
$memberIdintThe member whose record is updated.
$urlstringThe onboarding URL.
$expiresAtintThe expiry as a unix timestamp.

Returns void

UpsertConnectAccount

MemberStripeInfoDatabase::UpsertConnectAccount(int $memberId, string $connectAccountRef): int

Ensure a Stripe info row exists for the member and set or update its Connect account reference, returning the row id.

NameTypeDescription
$memberIdintThe member the row belongs to.
$connectAccountRefstringThe Stripe Connect account reference to store.

Returns int The row primary id.

MemberStripeUi

The module's HTTP route handlers and the payouts panel UI component. Handlers process Stripe onboarding refresh and return, the dashboard redirect and the webhook; each reads its query parameters and redirects or responds with JSON.

DashboardRedirect

MemberStripeUi::DashboardRedirect(): void

Route handler that obtains a dashboard login link and redirects the user, falling back to the fallback URL or a JSON error on failure. Reads the memberId and optional fallback query parameters.

Returns void

OnboardingRefresh

MemberStripeUi::OnboardingRefresh(): void

Route handler that generates a new onboarding link and redirects there, falling back to the fallback URL or a JSON error on failure. Reads the memberId, optional redirect and optional fallback query parameters.

Returns void

OnboardingReturn

MemberStripeUi::OnboardingReturn(): void

Route handler for the Stripe onboarding return URL: retrieves the latest account status from Stripe, persists it, then redirects or responds with JSON. Reads the memberId and optional redirect query parameters.

Returns void

PayoutsPanel

MemberStripeUi::PayoutsPanel(MemberStripeInfoData|null $optionalInfo, string $redirectPath): void

Render a payouts panel showing Stripe Connect status and the appropriate action button: connect, complete onboarding, or manage the account.

NameTypeDescription
$optionalInfoMemberStripeInfoData|nullThe member's Stripe info record, or null when none exists.
$redirectPathstringThe path the user should return to after Stripe steps.

Returns void

Webhook

MemberStripeUi::Webhook(): void

Stripe webhook endpoint: verifies the Stripe signature, decodes the event, resolves the connected account and updates the stored capability flags, responding with JSON.

Returns void