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.
MemberStripe- registers the module's HTTP routes.MemberStripeConnectService- Stripe Connect onboarding, links and the Stripe client.MemberStripeInfoData- the per-member Stripe info data object.MemberStripeInfoDatabase- reads and writes the member Stripe info row.MemberStripeUi- route handlers and the payouts panel component.
MemberStripe
The module's entry class. Registers the HTTP endpoints the Stripe Connect flow needs.
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.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member to onboard. |
$optionalRedirectUrl | string | Where the app should land after Stripe returns; empty for none. |
Returns string The onboarding URL.
CreateDashboardLoginLink
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.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member whose connected account is used. |
Returns string The dashboard login URL.
CreateOnboardingLink
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.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member whose account the link is for. |
$optionalRedirectUrl | string | Appended 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.
| Name | Type | Description |
|---|---|---|
$memberId | int | The 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
| Property | Type | Description |
|---|---|---|
$info->id | int | The row primary id (readonly). |
$info->memberId | int | The member the record belongs to (readonly). |
$info->customerRef | string|null | The Stripe customer reference, or null (readonly). |
$info->connectAccountRef | string|null | The Stripe Connect account reference, or null (readonly). |
$info->defaultPaymentMethodRef | string|null | The default payment method reference, or null (readonly). |
$info->onboardingCompletedAt | CalendarDateTimeData|null | When onboarding completed, or null (readonly). |
$info->emailVerified | bool | Whether the email is verified (readonly). |
$info->identityVerified | bool | Whether identity is verified (readonly). |
$info->externalAccountAdded | bool | Whether an external account has been added (readonly). |
$info->tosAccepted | bool | Whether the terms of service are accepted (readonly). |
$info->chargesEnabled | bool | Whether charges are enabled (readonly). |
$info->payoutsEnabled | bool | Whether payouts are enabled (readonly). |
$info->lastOnboardingUrl | string|null | The last cached onboarding URL, or null (readonly). |
$info->lastOnboardingUrlExpiresAt | CalendarDateTimeData|null | When the cached onboarding URL expires, or null (readonly). |
$info->lastDashboardUrl | string|null | The last cached dashboard URL, or null (readonly). |
$info->lastDashboardUrlExpiresAt | CalendarDateTimeData|null | When the cached dashboard URL expires, or null (readonly). |
$info->lastSyncedAt | CalendarDateTimeData|null | When the record was last synced with Stripe, or null (readonly). |
$info->createdAt | CalendarDateTimeData | When 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.
| Name | Type | Description |
|---|---|---|
$row | stdClass | The database row. |
Returns MemberStripeInfoData The mapped data object.
GetById
MemberStripeInfoDatabase::GetById(int $id): MemberStripeInfoData
Get a record by its primary id.
| Name | Type | Description |
|---|---|---|
$id | int | The 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.
| Name | Type | Description |
|---|---|---|
$connectAccountRef | string | The 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.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member to look up. |
Returns MemberStripeInfoData|null The record, or null.
UpdateDashboardLink
MemberStripeInfoDatabase::UpdateDashboardLink(int $memberId, string $url, int $expiresAt): void
Update the cached dashboard login link URL and its expiry for a member.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member whose record is updated. |
$url | string | The dashboard login URL. |
$expiresAt | int | The 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.
| Name | Type | Description |
|---|---|---|
$id | int | The row primary id. |
$chargesEnabled | bool | Whether charges are enabled. |
$payoutsEnabled | bool | Whether payouts are enabled. |
$tosAccepted | bool | Whether the terms of service are accepted. |
$externalAccountAdded | bool | Whether an external account has been added. |
$detailsSubmitted | bool | Whether 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.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member whose record is updated. |
$acc | \Stripe\Account | The Stripe Account object to read state from. |
Returns void
UpdateOnboardingLink
MemberStripeInfoDatabase::UpdateOnboardingLink(int $memberId, string $url, int $expiresAt): void
Update the onboarding link URL and its expiry for a member.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member whose record is updated. |
$url | string | The onboarding URL. |
$expiresAt | int | The 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.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member the row belongs to. |
$connectAccountRef | string | The 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.
| Name | Type | Description |
|---|---|---|
$optionalInfo | MemberStripeInfoData|null | The member's Stripe info record, or null when none exists. |
$redirectPath | string | The 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