PaymentProviderStripe

Reference for the PaymentProviderStripe module: a complete Stripe payment provider covering purchases, merchant Connect onboarding and customer records. Its classes route onboarding URLs, receive and dispatch Stripe webhooks, wrap the Stripe API, and read and write the module's own tables.

This page is a pure reference. It documents only the classes and functions the module's source defines, with their signatures, parameters and return types.

Classes and functions

The data objects on this page are immutable records built from readonly promoted constructor parameters. Several also expose ToJson and FromJson methods, and a few a FromStripeObject factory or a With method; these are documented on each class.

PaymentProviderStripe

The module class. Registers the module's HTTP routes under the current route directory.

Functions

Route

PaymentProviderStripe::Route(): void

Register the module's HTTP endpoints under the current route directory, including the onboarding handler for return and refresh URLs by permalink.

Returns void

PaymentProviderStripeOnboardingWebhook

A top-level function (not a class) registered by the module's route as the unified handler for Stripe onboarding return and refresh URLs.

PaymentProviderStripeOnboardingWebhook

PaymentProviderStripeOnboardingWebhook(string $permalink): void

Handle a Stripe onboarding return or refresh URL: look up the redirect record by permalink, and for refresh generate a new onboarding link and redirect, for return retrieve and persist the Stripe account status and redirect or return JSON, otherwise respond 400.

NameTypeDescription
$permalinkstringThe permalink identifying the stored redirect record.

Returns void

PaymentProviderStripeConnectService

Orchestrates Stripe Connect account creation, onboarding links, dashboard links, and account and balance retrieval.

BeginConnectOnboarding

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

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

NameTypeDescription
$memberIdintThe member to onboard.
$optionalRedirectUrlstringA redirect URL to return to, or empty for the default.

Returns string The onboarding link URL.

CreateAccountSession

PaymentProviderStripeConnectService::CreateAccountSession(string $connectAccountRef): string

Create a Stripe Account Session for Connect embedded components.

NameTypeDescription
$connectAccountRefstringThe connected account id.

Returns string The account session client_secret.

PaymentProviderStripeConnectService::CreateDashboardLoginLink(int $memberId): string

Create a one-time Stripe Dashboard login link for a member's connected account.

NameTypeDescription
$memberIdintThe member whose connected account to link to.

Returns string The dashboard login link URL.

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

Generate and persist an onboarding URL, with return and refresh permalinks, for a member's Connect account.

NameTypeDescription
$memberIdintThe member to onboard.
$optionalRedirectUrlstringA redirect URL to return to, or empty for the default.

Returns string The onboarding URL.

CreateStripeConnectAccount

PaymentProviderStripeConnectService::CreateStripeConnectAccount(int $memberId): void

Begin Stripe Connect onboarding for a member by ensuring a Connect account exists, creating one if needed, and persisting its state; throws on validation or Stripe API errors.

NameTypeDescription
$memberIdintThe member to create a Connect account for.

Returns void

FetchTransactionsAndBalances

PaymentProviderStripeConnectService::FetchTransactionsAndBalances(string $connectAccountRef): array

Fetch the balance, default external payout account, and payouts for a connected account.

NameTypeDescription
$connectAccountRefstringThe connected account id.

Returns array A map with the balance, default payment method and payouts.

stripeClient

PaymentProviderStripeConnectService::stripeClient(): \Stripe\StripeClient

Build and return a Stripe client using the configured secret key.

Returns \Stripe\StripeClient The Stripe client.

PaymentProviderStripeCustomerCommand

Command handlers for Stripe customer, payment method, setup intent and payment intent events, invoked by the customer webhook.

CustomerCreated

PaymentProviderStripeCustomerCommand::CustomerCreated($event, $object, $eventType): void

Handle the Stripe customer.created event by extracting customer data and member id from metadata and upserting a customer record.

Returns void

CustomerDeleted

PaymentProviderStripeCustomerCommand::CustomerDeleted($event, $object, $eventType): void

Handle customer.deleted by looking up the existing customer and logging it; the record is not deleted.

Returns void

CustomerUpdated

PaymentProviderStripeCustomerCommand::CustomerUpdated($event, $object, $eventType): void

Handle customer.updated by looking up the existing customer, updating its default payment method if changed, and upserting the record.

Returns void

PaymentIntentCanceled

PaymentProviderStripeCustomerCommand::PaymentIntentCanceled($event, $object, $eventType): void

Handle payment_intent.canceled by syncing the payment intent record from the Stripe object.

Returns void

PaymentIntentPaymentFailed

PaymentProviderStripeCustomerCommand::PaymentIntentPaymentFailed($event, $object, $eventType): void

Handle payment_intent.payment_failed by syncing the payment intent record from the Stripe object.

Returns void

PaymentIntentSucceeded

PaymentProviderStripeCustomerCommand::PaymentIntentSucceeded($event, $object, $eventType): void

Handle payment_intent.succeeded by syncing the payment intent record and, when metadata carries a ride id, notifying the ride payment intent webhook.

Returns void

PaymentMethodAttached

PaymentProviderStripeCustomerCommand::PaymentMethodAttached($event, $object, $eventType): void

Handle payment_method.attached by extracting card and billing details and upserting a payment method record.

Returns void

PaymentMethodDetached

PaymentProviderStripeCustomerCommand::PaymentMethodDetached($event, $object, $eventType): void

Handle payment_method.detached by looking up the payment method record and logging it; the record is not deleted.

Returns void

PaymentMethodUpdated

PaymentProviderStripeCustomerCommand::PaymentMethodUpdated($event, $object, $eventType): void

Handle payment_method.updated by re-extracting card and billing details and upserting the payment method record.

Returns void

SetupIntentSetupFailed

PaymentProviderStripeCustomerCommand::SetupIntentSetupFailed($event, $object, $eventType): void

Handle setup_intent.setup_failed by upserting a setup intent record with status requires_payment_method.

Returns void

SetupIntentSucceeded

PaymentProviderStripeCustomerCommand::SetupIntentSucceeded($event, $object, $eventType): void

Handle setup_intent.succeeded by upserting a setup intent record and, when metadata carries a ride id, notifying the ride setup intent webhook.

Returns void

StripeMetadataToJson

PaymentProviderStripeCustomerCommand::StripeMetadataToJson($metadataObj): ?string

Extract a Stripe metadata object's scalar key-value pairs into a JSON string, excluding SDK internals.

NameTypeDescription
$metadataObjmixedThe Stripe metadata object.

Returns ?string The metadata as JSON, or null when empty.

PaymentProviderStripeCustomerData

A Stripe Customer API response.

Properties

NameType
$idstring
$email?string
$name?string
$phone?string
$description?string
$created?int
$defaultSource?string
$invoicePrefix?string
$currency?string
$delinquent?bool
$balance?int

__construct

PaymentProviderStripeCustomerData::__construct(string $id = '', ?string $email = null, ?string $name = null, ?string $phone = null, ?string $description = null, ?int $created = null, ?string $defaultSource = null, ?string $invoicePrefix = null, ?string $currency = null, ?bool $delinquent = null, ?int $balance = null)

Construct the customer data object from its field values.

FromJson

PaymentProviderStripeCustomerData::FromJson(string $json): self

Build a customer data object from its JSON representation.

Returns self The customer data object.

FromStripeObject

PaymentProviderStripeCustomerData::FromStripeObject(object $stripeCustomer): self

Build a customer data object from a Stripe Customer object.

NameTypeDescription
$stripeCustomerobjectThe Stripe Customer object.

Returns self The customer data object.

ToJson

PaymentProviderStripeCustomerData::ToJson(): string

Serialise the customer data object to JSON.

Returns string The JSON representation.

PaymentProviderStripeCustomerDatabase

Reads and writes stored Stripe customer rows.

fromRow

PaymentProviderStripeCustomerDatabase::fromRow(stdClass $row): PaymentProviderStripeCustomerRowData

Construct the customer row data object from a database row.

NameTypeDescription
$rowstdClassThe raw database row.

Returns PaymentProviderStripeCustomerRowData The mapped row.

GetById

PaymentProviderStripeCustomerDatabase::GetById(int $id): PaymentProviderStripeCustomerRowData

Get a customer by primary id.

NameTypeDescription
$idintThe customer row id.

Returns PaymentProviderStripeCustomerRowData The customer row.

GetByIds

PaymentProviderStripeCustomerDatabase::GetByIds(array $ids): array

Bulk-fetch customers by an array of ids.

NameTypeDescription
$idsarrayThe customer row ids.

Returns array The matching customer rows.

GetOptionalByMemberId

PaymentProviderStripeCustomerDatabase::GetOptionalByMemberId(int $memberId): PaymentProviderStripeCustomerRowData|null

Get a customer by member id, or null when there is no match.

NameTypeDescription
$memberIdintThe member id.

Returns PaymentProviderStripeCustomerRowData|null The customer row, or null.

GetOptionalByStripeReference

PaymentProviderStripeCustomerDatabase::GetOptionalByStripeReference(string $stripeReference): PaymentProviderStripeCustomerRowData|null

Get a customer by Stripe reference, or null when there is no match.

NameTypeDescription
$stripeReferencestringThe Stripe customer reference.

Returns PaymentProviderStripeCustomerRowData|null The customer row, or null.

UpdateDefaultPaymentMethod

PaymentProviderStripeCustomerDatabase::UpdateDefaultPaymentMethod(int $customerId, string|null $paymentMethodRef): void

Update the default payment method reference for a customer.

NameTypeDescription
$customerIdintThe customer row id.
$paymentMethodRefstring|nullThe default payment method reference, or null.

Returns void

Upsert

PaymentProviderStripeCustomerDatabase::Upsert(int $memberId, string $stripeReference, string|null $email = null, string|null $name = null, string|null $phone = null, string|null $description = null, string|null $metadata = null): int

Create or update a customer record and return its id.

NameTypeDescription
$memberIdintThe member the customer belongs to.
$stripeReferencestringThe Stripe customer reference.
$emailstring|nullThe customer email, or null.
$namestring|nullThe customer name, or null.
$phonestring|nullThe customer phone, or null.
$descriptionstring|nullThe customer description, or null.
$metadatastring|nullThe metadata JSON, or null.

Returns int The customer row id.

PaymentProviderStripeCustomerEventData

A Stripe customer-related event, with the customer id and object info extracted from the event structure.

Properties

NameType
$eventobject
$customerIdstring
$objectIdstring|null
$objectTypestring|null

__construct

PaymentProviderStripeCustomerEventData::__construct(object $event, string $customerId = '', string|null $objectId = null, string|null $objectType = null)

Construct the customer event data object from its field values.

FromJson

PaymentProviderStripeCustomerEventData::FromJson(string $eventJson): self

Build a customer event data object from the event JSON.

NameTypeDescription
$eventJsonstringThe Stripe event JSON.

Returns self The customer event data object.

ToJson

PaymentProviderStripeCustomerEventData::ToJson(): string

Serialise the customer event data object to JSON.

Returns string The JSON representation.

PaymentProviderStripeCustomerRowData

A database row for a stored Stripe customer.

Properties

NameType
$idint
$emailstring|null
$namestring|null
$phonestring|null
$descriptionstring|null
$metadatastring|null
$memberIdint
$stripeReferencestring
$defaultPaymentMethodRefstring|null
$addedDateCalendarDateData
$addedTimestampCalendarDateTimeData
$lastSyncedAtCalendarDateTimeData|null

__construct

PaymentProviderStripeCustomerRowData::__construct(int $id = 0, string|null $email = null, string|null $name = null, string|null $phone = null, string|null $description = null, string|null $metadata = null, int $memberId = 0, string $stripeReference = '', string|null $defaultPaymentMethodRef = null, CalendarDateData $addedDate = new CalendarDateData(), CalendarDateTimeData $addedTimestamp = new CalendarDateTimeData(), CalendarDateTimeData|null $lastSyncedAt = null)

Construct the customer row data object from its field values.

FromJson

PaymentProviderStripeCustomerRowData::FromJson(string $json): self

Build a customer row data object from its JSON representation.

Returns self The customer row data object.

ToJson

PaymentProviderStripeCustomerRowData::ToJson(): string

Serialise the customer row data object to JSON.

Returns string The JSON representation.

PaymentProviderStripeCustomerWebhook

Dispatches the Stripe customer webhook.

Functions

Handle

PaymentProviderStripeCustomerWebhook::Handle($requestMethod, $requestBody, $headers): void

Register the customer, payment method, setup intent and payment intent event handlers and dispatch the request through the core webhook handler using the configured webhook secret.

NameTypeDescription
$requestMethodmixedThe HTTP request method.
$requestBodymixedThe raw request body.
$headersmixedThe request headers.

Returns void

PaymentProviderStripeDatabase

Common Stripe API wrapper functions. All take the secret key as a parameter and do not read Config directly.

CreateCustomer

PaymentProviderStripeDatabase::CreateCustomer(string $secretKey, string $email, array $metadata = []): PaymentProviderStripeCustomerData

Create a Stripe Customer.

NameTypeDescription
$secretKeystringThe Stripe secret key.
$emailstringThe customer email.
$metadataarrayMetadata to attach to the customer.

Returns PaymentProviderStripeCustomerData The created customer.

CreatePaymentIntent

PaymentProviderStripeDatabase::CreatePaymentIntent(string $secretKey, int $amountInCents, string $currency, string $description, string $receiptEmail, ?string $customerId = null, array $additionalParams = []): PaymentProviderStripePaymentIntentData

Create a Stripe PaymentIntent.

NameTypeDescription
$secretKeystringThe Stripe secret key.
$amountInCentsintThe amount in the currency's smallest unit.
$currencystringThe currency code.
$descriptionstringThe payment description.
$receiptEmailstringThe receipt email address.
$customerId?stringThe Stripe customer id, or null.
$additionalParamsarrayExtra parameters for the PaymentIntent.

Returns PaymentProviderStripePaymentIntentData The created payment intent.

RetrieveCustomer

PaymentProviderStripeDatabase::RetrieveCustomer(string $secretKey, string $customerId): PaymentProviderStripeCustomerData

Retrieve a Stripe Customer by id.

NameTypeDescription
$secretKeystringThe Stripe secret key.
$customerIdstringThe Stripe customer id.

Returns PaymentProviderStripeCustomerData The customer.

RetrievePaymentIntent

PaymentProviderStripeDatabase::RetrievePaymentIntent(string $secretKey, string $paymentIntentId): PaymentProviderStripePaymentIntentData

Retrieve a Stripe PaymentIntent by id.

NameTypeDescription
$secretKeystringThe Stripe secret key.
$paymentIntentIdstringThe Stripe payment intent id.

Returns PaymentProviderStripePaymentIntentData The payment intent.

PaymentProviderStripeMerchantAccountEventData

A Stripe Connect account event, with the account id extracted from the event structure.

Properties

NameType
$eventobject
$accountIdstring

__construct

PaymentProviderStripeMerchantAccountEventData::__construct(object $event, string $accountId = '')

Construct the merchant account event data object from its field values.

FromJson

PaymentProviderStripeMerchantAccountEventData::FromJson(string $eventJson): self

Build a merchant account event data object from the event JSON.

NameTypeDescription
$eventJsonstringThe Stripe event JSON.

Returns self The merchant account event data object.

ToJson

PaymentProviderStripeMerchantAccountEventData::ToJson(): string

Serialise the merchant account event data object to JSON.

Returns string The JSON representation.

PaymentProviderStripeMerchantCommand

Command handlers for Stripe Connect account events, invoked by the merchant webhook.

AccountDeauthorized

PaymentProviderStripeMerchantCommand::AccountDeauthorized($event, $object, $eventType): void

Handle account.application.deauthorized by adding a pending status to the merchant, marking the account disconnected.

Returns void

AccountUpdated

PaymentProviderStripeMerchantCommand::AccountUpdated($event, $object, $eventType): void

Handle Stripe Connect account.updated by looking up the merchant, deriving the charges, payouts, TOS, external-account and details flags, adding a merchant status, and updating account flags.

Returns void

ExternalAccountCreated

PaymentProviderStripeMerchantCommand::ExternalAccountCreated($event, $object, $eventType): void

Handle account.external_account.created by marking the merchant's external account status true and updating Stripe merchant flags.

Returns void

ExternalAccountDeleted

PaymentProviderStripeMerchantCommand::ExternalAccountDeleted($event, $object, $eventType): void

Handle account.external_account.deleted by marking the merchant's external account status false and updating Stripe merchant flags.

Returns void

ExternalAccountUpdated

PaymentProviderStripeMerchantCommand::ExternalAccountUpdated($event, $object, $eventType): void

Handle account.external_account.updated by marking the merchant's external account status true and updating Stripe merchant flags.

Returns void

PaymentProviderStripeMerchantConnectCommand

A self-contained Stripe Connect webhook handler.

Functions

Handle

PaymentProviderStripeMerchantConnectCommand::Handle(string $requestMethod, string $requestBody, array $headers): void

Normalise headers, verify the signature, decode JSON, resolve the connected account id, look up the merchant, extract account flags, and update merchant status and flags, writing HTTP responses directly.

NameTypeDescription
$requestMethodstringThe HTTP request method.
$requestBodystringThe raw request body.
$headersarrayThe request headers.

Returns void

PaymentProviderStripeMerchantData

A merchant's Stripe Connect onboarding and account state.

Properties

NameType
$idint
$memberIdint
$connectAccountRefstring|null
$onboardingCompletedAtCalendarDateTimeData|null
$emailVerifiedbool
$identityVerifiedbool
$externalAccountAddedbool
$tosAcceptedbool
$chargesEnabledbool
$payoutsEnabledbool
$lastOnboardingUrlstring|null
$lastOnboardingUrlExpiresAtCalendarDateTimeData|null
$lastSyncedAtCalendarDateTimeData|null
$createdAtCalendarDateTimeData

__construct

PaymentProviderStripeMerchantData::__construct(int $id = 0, int $memberId = 0, string|null $connectAccountRef = 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, CalendarDateTimeData|null $lastSyncedAt = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData())

Construct the merchant data object from its field values.

FromJson

PaymentProviderStripeMerchantData::FromJson(string $json): self

Build a merchant data object from its JSON representation.

Returns self The merchant data object.

ToJson

PaymentProviderStripeMerchantData::ToJson(): string

Serialise the merchant data object to JSON.

Returns string The JSON representation.

PaymentProviderStripeMerchantDatabase

Reads and writes stored Stripe merchant and Connect account rows.

fromRow

PaymentProviderStripeMerchantDatabase::fromRow(stdClass $row): PaymentProviderStripeMerchantData

Construct the merchant data object from a database row.

NameTypeDescription
$rowstdClassThe raw database row.

Returns PaymentProviderStripeMerchantData The mapped row.

GetById

PaymentProviderStripeMerchantDatabase::GetById(int $id): PaymentProviderStripeMerchantData

Get a merchant by primary id.

NameTypeDescription
$idintThe merchant row id.

Returns PaymentProviderStripeMerchantData The merchant row.

GetByIds

PaymentProviderStripeMerchantDatabase::GetByIds(array $ids): array

Bulk-fetch merchants by an array of ids.

NameTypeDescription
$idsarrayThe merchant row ids.

Returns array The matching merchant rows.

GetOptionalByConnectAccountRef

PaymentProviderStripeMerchantDatabase::GetOptionalByConnectAccountRef(string $connectAccountRef): PaymentProviderStripeMerchantData|null

Get a merchant by Stripe Connect account id, or null when there is no match.

NameTypeDescription
$connectAccountRefstringThe Connect account id.

Returns PaymentProviderStripeMerchantData|null The merchant row, or null.

GetOptionalByMemberId

PaymentProviderStripeMerchantDatabase::GetOptionalByMemberId(int $memberId): PaymentProviderStripeMerchantData|null

Get the latest merchant record for a member id, or null when there is no match.

NameTypeDescription
$memberIdintThe member id.

Returns PaymentProviderStripeMerchantData|null The merchant row, or null.

UpdateFlagsById

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

Update the Stripe capability flags for the row by primary id.

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

Returns void

UpdateFromStripeAccountByMemberId

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

Update database fields for a member from a Stripe Account object.

NameTypeDescription
$memberIdintThe member id.
$acc\Stripe\AccountThe Stripe Account object.

Returns void

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

Update the onboarding link URL and expiry for a member.

NameTypeDescription
$memberIdintThe member id.
$urlstringThe onboarding link URL.
$expiresAtintThe link expiry timestamp.

Returns void

UpsertConnectAccount

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

Ensure a merchant row for the member and set or update the Connect account reference, returning the row id.

NameTypeDescription
$memberIdintThe member id.
$connectAccountRefstringThe Connect account id.

Returns int The merchant row id.

PaymentProviderStripeMerchantWebhook

Dispatches the Stripe Connect account webhook.

Functions

Handle

PaymentProviderStripeMerchantWebhook::Handle($requestMethod, $requestBody, $headers): void

Register the Stripe Connect account event handlers and dispatch the request through the core webhook handler.

NameTypeDescription
$requestMethodmixedThe HTTP request method.
$requestBodymixedThe raw request body.
$headersmixedThe request headers.

Returns void

PaymentProviderStripePaymentIntentData

A Stripe PaymentIntent API response.

Properties

NameType
$idstring
$clientSecret?string
$status?string
$amount?int
$currency?string
$description?string
$customer?string
$created?int
$paymentMethod?string
$latestCharge?string
$amountCapturable?int
$amountReceived?int
$cancelReason?string
$cancellationReason?string
$receiptEmail?string

__construct

PaymentProviderStripePaymentIntentData::__construct(string $id = '', ?string $clientSecret = null, ?string $status = null, ?int $amount = null, ?string $currency = null, ?string $description = null, ?string $customer = null, ?int $created = null, ?string $paymentMethod = null, ?string $latestCharge = null, ?int $amountCapturable = null, ?int $amountReceived = null, ?string $cancelReason = null, ?string $cancellationReason = null, ?string $receiptEmail = null)

Construct the payment intent data object from its field values.

FromJson

PaymentProviderStripePaymentIntentData::FromJson(string $json): self

Build a payment intent data object from its JSON representation.

Returns self The payment intent data object.

FromStripeObject

PaymentProviderStripePaymentIntentData::FromStripeObject(object $stripePaymentIntent): self

Build a payment intent data object from a Stripe PaymentIntent object.

NameTypeDescription
$stripePaymentIntentobjectThe Stripe PaymentIntent object.

Returns self The payment intent data object.

ToJson

PaymentProviderStripePaymentIntentData::ToJson(): string

Serialise the payment intent data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePaymentIntentDatabase

Reads and writes stored Stripe payment intent rows.

fromRow

PaymentProviderStripePaymentIntentDatabase::fromRow(stdClass $row): PaymentProviderStripePaymentIntentRowData

Construct the payment intent row data object from a database row.

NameTypeDescription
$rowstdClassThe raw database row.

Returns PaymentProviderStripePaymentIntentRowData The mapped row.

GetByCustomerId

PaymentProviderStripePaymentIntentDatabase::GetByCustomerId(int $customerId): array

Get payment intents by customer id.

NameTypeDescription
$customerIdintThe customer row id.

Returns array The matching payment intent rows.

GetById

PaymentProviderStripePaymentIntentDatabase::GetById(int $id): PaymentProviderStripePaymentIntentRowData

Get a payment intent by primary id.

NameTypeDescription
$idintThe payment intent row id.

Returns PaymentProviderStripePaymentIntentRowData The payment intent row.

GetByIds

PaymentProviderStripePaymentIntentDatabase::GetByIds(array $ids): array

Bulk-fetch payment intents by an array of ids.

NameTypeDescription
$idsarrayThe payment intent row ids.

Returns array The matching payment intent rows.

GetByMerchantId

PaymentProviderStripePaymentIntentDatabase::GetByMerchantId(int $merchantId): array

Get payment intents by merchant id.

NameTypeDescription
$merchantIdintThe merchant row id.

Returns array The matching payment intent rows.

GetOptionalByStripeReference

PaymentProviderStripePaymentIntentDatabase::GetOptionalByStripeReference(string $stripeReference): PaymentProviderStripePaymentIntentRowData|null

Get a payment intent by Stripe reference, or null when there is no match.

NameTypeDescription
$stripeReferencestringThe Stripe payment intent reference.

Returns PaymentProviderStripePaymentIntentRowData|null The payment intent row, or null.

Upsert

PaymentProviderStripePaymentIntentDatabase::Upsert(string $stripeReference, int|null $customerId = null, int|null $merchantId = null, int|null $paymentMethodId = null, int $amountMillipence = 0, string $currency = '', string $status = '', string|null $clientSecret = null, int|null $applicationFeeAmountMillipence = null, int|null $transferAmountMillipence = null, int|null $amountReceivedMillipence = null, int|null $amountCapturableMillipence = null, string|null $description = null, string|null $receiptEmail = null, string|null $cancellationReason = null, string|null $latestChargeRef = null, string|null $metadata = null): int

Create or update a payment intent record and return its id.

Returns int The payment intent row id.

PaymentProviderStripePaymentIntentRowData

A database row for a stored Stripe PaymentIntent, with amounts in millipence.

Properties

NameType
$idint
$stripeReferencestring
$customerIdint|null
$merchantIdint|null
$paymentMethodIdint|null
$amountMillipenceint
$currencystring
$statusstring
$clientSecretstring|null
$applicationFeeAmountMillipenceint|null
$transferAmountMillipenceint|null
$amountReceivedMillipenceint|null
$amountCapturableMillipenceint|null
$descriptionstring|null
$receiptEmailstring|null
$cancellationReasonstring|null
$latestChargeRefstring|null
$metadatastring|null
$createdAtCalendarDateTimeData
$lastSyncedAtCalendarDateTimeData|null

__construct

PaymentProviderStripePaymentIntentRowData::__construct(int $id = 0, string $stripeReference = '', int|null $customerId = null, int|null $merchantId = null, int|null $paymentMethodId = null, int $amountMillipence = 0, string $currency = '', string $status = '', string|null $clientSecret = null, int|null $applicationFeeAmountMillipence = null, int|null $transferAmountMillipence = null, int|null $amountReceivedMillipence = null, int|null $amountCapturableMillipence = null, string|null $description = null, string|null $receiptEmail = null, string|null $cancellationReason = null, string|null $latestChargeRef = null, string|null $metadata = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData(), CalendarDateTimeData|null $lastSyncedAt = null)

Construct the payment intent row data object from its field values.

FromJson

PaymentProviderStripePaymentIntentRowData::FromJson(string $json): self

Build a payment intent row data object from its JSON representation.

Returns self The payment intent row data object.

ToJson

PaymentProviderStripePaymentIntentRowData::ToJson(): string

Serialise the payment intent row data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePaymentMethodDatabase

Reads and writes stored Stripe payment method rows.

fromRow

PaymentProviderStripePaymentMethodDatabase::fromRow(stdClass $row): PaymentProviderStripePaymentMethodRowData

Construct the payment method row data object from a database row.

NameTypeDescription
$rowstdClassThe raw database row.

Returns PaymentProviderStripePaymentMethodRowData The mapped row.

GetByCustomerId

PaymentProviderStripePaymentMethodDatabase::GetByCustomerId(int $customerId): array

Get payment methods by customer id.

NameTypeDescription
$customerIdintThe customer row id.

Returns array The matching payment method rows.

GetById

PaymentProviderStripePaymentMethodDatabase::GetById(int $id): PaymentProviderStripePaymentMethodRowData

Get a payment method by primary id.

NameTypeDescription
$idintThe payment method row id.

Returns PaymentProviderStripePaymentMethodRowData The payment method row.

GetByIds

PaymentProviderStripePaymentMethodDatabase::GetByIds(array $ids): array

Bulk-fetch payment methods by an array of ids.

NameTypeDescription
$idsarrayThe payment method row ids.

Returns array The matching payment method rows.

GetDefaultByCustomerId

PaymentProviderStripePaymentMethodDatabase::GetDefaultByCustomerId(int $customerId): PaymentProviderStripePaymentMethodRowData|null

Get the default payment method for a customer, or null when there is none.

NameTypeDescription
$customerIdintThe customer row id.

Returns PaymentProviderStripePaymentMethodRowData|null The default payment method row, or null.

GetOptionalByStripeReference

PaymentProviderStripePaymentMethodDatabase::GetOptionalByStripeReference(string $stripeReference): PaymentProviderStripePaymentMethodRowData|null

Get a payment method by Stripe reference, or null when there is no match.

NameTypeDescription
$stripeReferencestringThe Stripe payment method reference.

Returns PaymentProviderStripePaymentMethodRowData|null The payment method row, or null.

SetAsDefault

PaymentProviderStripePaymentMethodDatabase::SetAsDefault(int $paymentMethodId, int $customerId): void

Set a payment method as default for a customer.

NameTypeDescription
$paymentMethodIdintThe payment method row id.
$customerIdintThe customer row id.

Returns void

Upsert

PaymentProviderStripePaymentMethodDatabase::Upsert(string $stripeReference, int $customerId, string $type, bool $isDefault = false, string|null $cardBrand = null, string|null $cardLast4 = null, int|null $cardExpMonth = null, int|null $cardExpYear = null, string|null $cardFingerprint = null, string|null $billingDetailsName = null, string|null $billingDetailsEmail = null, string|null $billingDetailsPhone = null, string|null $metadata = null): int

Create or update a payment method record and return its id.

Returns int The payment method row id.

PaymentProviderStripePaymentMethodRowData

A database row for a stored Stripe payment method or card.

Properties

NameType
$idint
$stripeReferencestring
$customerIdint
$typestring
$isDefaultbool
$cardBrandstring|null
$cardLast4string|null
$cardExpMonthint|null
$cardExpYearint|null
$cardFingerprintstring|null
$billingDetailsNamestring|null
$billingDetailsEmailstring|null
$billingDetailsPhonestring|null
$metadatastring|null
$createdAtCalendarDateTimeData
$lastSyncedAtCalendarDateTimeData|null

__construct

PaymentProviderStripePaymentMethodRowData::__construct(int $id = 0, string $stripeReference = '', int $customerId = 0, string $type = '', bool $isDefault = false, string|null $cardBrand = null, string|null $cardLast4 = null, int|null $cardExpMonth = null, int|null $cardExpYear = null, string|null $cardFingerprint = null, string|null $billingDetailsName = null, string|null $billingDetailsEmail = null, string|null $billingDetailsPhone = null, string|null $metadata = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData(), CalendarDateTimeData|null $lastSyncedAt = null)

Construct the payment method row data object from its field values.

FromJson

PaymentProviderStripePaymentMethodRowData::FromJson(string $json): self

Build a payment method row data object from its JSON representation.

Returns self The payment method row data object.

ToJson

PaymentProviderStripePaymentMethodRowData::ToJson(): string

Serialise the payment method row data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePaymentStatusAmountCapturableData

A Stripe amount-capturable status update.

Properties

NameType
$amountCapturable?int
$eventId?string

__construct

PaymentProviderStripePaymentStatusAmountCapturableData::__construct(?int $amountCapturable = null, ?string $eventId = null)

Construct the amount-capturable status data object from its field values.

FromJson

PaymentProviderStripePaymentStatusAmountCapturableData::FromJson(string $json): self

Build an amount-capturable status data object from its JSON representation.

Returns self The status data object.

ToJson

PaymentProviderStripePaymentStatusAmountCapturableData::ToJson(): string

Serialise the amount-capturable status data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePaymentStatusChargeData

A Stripe charge status update.

Properties

NameType
$chargeId?string
$chargeStatus?string
$chargeFailureReason?string
$balanceTransactionId?string
$eventId?string

__construct

PaymentProviderStripePaymentStatusChargeData::__construct(?string $chargeId = null, ?string $chargeStatus = null, ?string $chargeFailureReason = null, ?string $balanceTransactionId = null, ?string $eventId = null)

Construct the charge status data object from its field values.

FromJson

PaymentProviderStripePaymentStatusChargeData::FromJson(string $json): self

Build a charge status data object from its JSON representation.

Returns self The status data object.

ToJson

PaymentProviderStripePaymentStatusChargeData::ToJson(): string

Serialise the charge status data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePaymentStatusDisputeData

A Stripe dispute status update.

Properties

NameType
$disputeId?string
$disputeStatus?string
$disputeReason?string
$eventId?string

__construct

PaymentProviderStripePaymentStatusDisputeData::__construct(?string $disputeId = null, ?string $disputeStatus = null, ?string $disputeReason = null, ?string $eventId = null)

Construct the dispute status data object from its field values.

FromJson

PaymentProviderStripePaymentStatusDisputeData::FromJson(string $json): self

Build a dispute status data object from its JSON representation.

Returns self The status data object.

ToJson

PaymentProviderStripePaymentStatusDisputeData::ToJson(): string

Serialise the dispute status data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePaymentStatusRefundData

A Stripe refund status update.

Properties

NameType
$chargeId?string
$refunded?bool
$amountRefunded?int
$eventId?string

__construct

PaymentProviderStripePaymentStatusRefundData::__construct(?string $chargeId = null, ?bool $refunded = null, ?int $amountRefunded = null, ?string $eventId = null)

Construct the refund status data object from its field values.

FromJson

PaymentProviderStripePaymentStatusRefundData::FromJson(string $json): self

Build a refund status data object from its JSON representation.

Returns self The status data object.

ToJson

PaymentProviderStripePaymentStatusRefundData::ToJson(): string

Serialise the refund status data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePaymentStatusRequiresCaptureData

A Stripe payment intent requires-capture status.

Properties

NameType
$paymentIntentIdstring
$eventId?string
$amountCapturable?int

__construct

PaymentProviderStripePaymentStatusRequiresCaptureData::__construct(string $paymentIntentId = '', ?string $eventId = null, ?int $amountCapturable = null)

Construct the requires-capture status data object from its field values.

FromJson

PaymentProviderStripePaymentStatusRequiresCaptureData::FromJson(string $json): self

Build a requires-capture status data object from its JSON representation.

Returns self The status data object.

ToJson

PaymentProviderStripePaymentStatusRequiresCaptureData::ToJson(): string

Serialise the requires-capture status data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePaymentStatusTransferData

A Stripe transfer status update.

Properties

NameType
$transferId?string
$transferDestination?string
$transferStatus?string
$transferFailureReason?string
$eventId?string

__construct

PaymentProviderStripePaymentStatusTransferData::__construct(?string $transferId = null, ?string $transferDestination = null, ?string $transferStatus = null, ?string $transferFailureReason = null, ?string $eventId = null)

Construct the transfer status data object from its field values.

FromJson

PaymentProviderStripePaymentStatusTransferData::FromJson(string $json): self

Build a transfer status data object from its JSON representation.

Returns self The status data object.

ToJson

PaymentProviderStripePaymentStatusTransferData::ToJson(): string

Serialise the transfer status data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePurchaseAmountCapturableUpdatedData

A Stripe amount-capturable-updated status.

Properties

NameType
$paymentIntentIdstring
$eventId?string
$amountCapturable?int

__construct

PaymentProviderStripePurchaseAmountCapturableUpdatedData::__construct(string $paymentIntentId = '', ?string $eventId = null, ?int $amountCapturable = null)

Construct the amount-capturable-updated data object from its field values.

FromJson

PaymentProviderStripePurchaseAmountCapturableUpdatedData::FromJson(string $json): self

Build an amount-capturable-updated data object from its JSON representation.

Returns self The data object.

ToJson

PaymentProviderStripePurchaseAmountCapturableUpdatedData::ToJson(): string

Serialise the amount-capturable-updated data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePurchaseChargeCommand

Command handlers for charge-level, refund and dispute events, invoked by the purchase charge webhook.

ChargeDisputeClosed

PaymentProviderStripePurchaseChargeCommand::ChargeDisputeClosed($event, $dispute, $eventType, $purchase): void

Handle charge.dispute.closed by adding a purchase status record with dispute data.

Returns void

ChargeDisputeCreated

PaymentProviderStripePurchaseChargeCommand::ChargeDisputeCreated($event, $dispute, $eventType, $purchase): void

Handle charge.dispute.created by adding a purchase status record with dispute data.

Returns void

ChargeDisputeUpdated

PaymentProviderStripePurchaseChargeCommand::ChargeDisputeUpdated($event, $dispute, $eventType, $purchase): void

Handle charge.dispute.updated by adding a purchase status record with dispute data.

Returns void

ChargeFailed

PaymentProviderStripePurchaseChargeCommand::ChargeFailed($event, $charge, $eventType, $purchase): void

Handle charge.failed by adding a purchase status record with the failure reason.

Returns void

ChargeRefunded

PaymentProviderStripePurchaseChargeCommand::ChargeRefunded($event, $charge, $eventType, $purchase): void

Handle charge.refunded by adding a purchase status record with refund data, whether full or partial.

Returns void

ChargeRefundUpdated

PaymentProviderStripePurchaseChargeCommand::ChargeRefundUpdated($event, $charge, $eventType, $purchase): void

Handle charge.refund.updated by adding a purchase status record with the refund id and status.

Returns void

ChargeSucceeded

PaymentProviderStripePurchaseChargeCommand::ChargeSucceeded($event, $charge, $eventType, $purchase): void

Handle charge.succeeded by adding a purchase status record with charge success data.

Returns void

ChargeUpdated

PaymentProviderStripePurchaseChargeCommand::ChargeUpdated($event, $charge, $eventType, $purchase): void

Handle charge.updated by adding a purchase status record with the charge status.

Returns void

PaymentProviderStripePurchaseCommand

Command handlers for payment intent completion events, invoked by the purchase webhook.

PaymentIntentCanceled

PaymentProviderStripePurchaseCommand::PaymentIntentCanceled($event, $paymentIntent, $eventType, $purchase): void

Handle payment_intent.canceled by adding a cancelled purchase status.

Returns void

PaymentIntentPaymentFailed

PaymentProviderStripePurchaseCommand::PaymentIntentPaymentFailed($event, $paymentIntent, $eventType, $purchase): void

Handle payment_intent.payment_failed by adding an error purchase status with the failure reason.

Returns void

PaymentIntentSucceeded

PaymentProviderStripePurchaseCommand::PaymentIntentSucceeded($event, $paymentIntent, $eventType, $purchase): void

Handle payment_intent.succeeded by adding a success purchase status with the payment intent id as provider data.

Returns void

PaymentProviderStripePurchaseData

Stripe-specific initial purchase provider data.

Properties

NameType
$customerId?string
$paymentIntentId?string

__construct

PaymentProviderStripePurchaseData::__construct(?string $customerId = null, ?string $paymentIntentId = null)

Construct the purchase data object from its field values.

FromJson

PaymentProviderStripePurchaseData::FromJson(string $json): self

Build a purchase data object from its JSON representation.

Returns self The purchase data object.

ToJson

PaymentProviderStripePurchaseData::ToJson(): string

Serialise the purchase data object to JSON.

Returns string The JSON representation.

WithPaymentIntentId

PaymentProviderStripePurchaseData::WithPaymentIntentId(?string $paymentIntentId): self

Return a copy of the purchase data with the given payment intent id.

NameTypeDescription
$paymentIntentId?stringThe payment intent id, or null.

Returns self A new purchase data object.

PaymentProviderStripePurchaseDatabase

Database operations for the Stripe purchase provider.

Functions

GetPaymentStatus

PaymentProviderStripePurchaseDatabase::GetPaymentStatus(string $paymentSecret): PaymentProviderPaymentStatusEnum

Retrieve and map the Stripe payment status from a client secret to a payment status enum value.

NameTypeDescription
$paymentSecretstringThe payment intent client secret.

Returns PaymentProviderPaymentStatusEnum The mapped payment status.

PaymentProviderStripePurchaseEventData

Basic Stripe payment intent event data.

Properties

NameType
$paymentIntentIdstring
$eventId?string

__construct

PaymentProviderStripePurchaseEventData::__construct(string $paymentIntentId = '', ?string $eventId = null)

Construct the purchase event data object from its field values.

FromJson

PaymentProviderStripePurchaseEventData::FromJson(string $json): self

Build a purchase event data object from its JSON representation.

Returns self The purchase event data object.

ToJson

PaymentProviderStripePurchaseEventData::ToJson(): string

Serialise the purchase event data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePurchasePaymentIntentIdData

A payment intent id stored as provider data in status records.

Properties

NameType
$paymentIntentIdstring

__construct

PaymentProviderStripePurchasePaymentIntentIdData::__construct(string $paymentIntentId = '')

Construct the payment intent id data object from its field value.

FromJson

PaymentProviderStripePurchasePaymentIntentIdData::FromJson(string $json): self

Build a payment intent id data object from its JSON representation.

Returns self The data object.

ToJson

PaymentProviderStripePurchasePaymentIntentIdData::ToJson(): string

Serialise the payment intent id data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePurchaseRequiresActionData

A Stripe payment intent requires-action event.

Properties

NameType
$paymentIntentIdstring
$eventId?string
$nextActionJson?string

__construct

PaymentProviderStripePurchaseRequiresActionData::__construct(string $paymentIntentId = '', ?string $eventId = null, ?string $nextActionJson = null)

Construct the requires-action data object from its field values.

FromJson

PaymentProviderStripePurchaseRequiresActionData::FromJson(string $json): self

Build a requires-action data object from its JSON representation.

Returns self The data object.

ToJson

PaymentProviderStripePurchaseRequiresActionData::ToJson(): string

Serialise the requires-action data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePurchaseRequiresCaptureData

A Stripe payment intent requires-capture event.

Properties

NameType
$paymentIntentIdstring
$eventId?string
$amountCapturable?int

__construct

PaymentProviderStripePurchaseRequiresCaptureData::__construct(string $paymentIntentId = '', ?string $eventId = null, ?int $amountCapturable = null)

Construct the requires-capture data object from its field values.

FromJson

PaymentProviderStripePurchaseRequiresCaptureData::FromJson(string $json): self

Build a requires-capture data object from its JSON representation.

Returns self The data object.

ToJson

PaymentProviderStripePurchaseRequiresCaptureData::ToJson(): string

Serialise the requires-capture data object to JSON.

Returns string The JSON representation.

PaymentProviderStripePurchaseStateCommand

Command handlers for payment intent state-change events, invoked by the purchase state webhook.

PaymentIntentAmountCapturableUpdated

PaymentProviderStripePurchaseStateCommand::PaymentIntentAmountCapturableUpdated($event, $paymentIntent, $eventType): void

Handle payment_intent.amount_capturable_updated by looking up the purchase via client secret then delegating to the with-purchase handler.

Returns void

PaymentIntentAmountCapturableUpdatedWithPurchase

PaymentProviderStripePurchaseStateCommand::PaymentIntentAmountCapturableUpdatedWithPurchase($event, $paymentIntent, $eventType, PaymentPurchaseData $purchase): void

Add a purchase status, keeping the existing status, recording the updated capturable amount.

Returns void

PaymentIntentCreated

PaymentProviderStripePurchaseStateCommand::PaymentIntentCreated($event, $paymentIntent, $eventType): void

Handle payment_intent.created by looking up the purchase via client secret then delegating to the with-purchase handler.

Returns void

PaymentIntentCreatedWithPurchase

PaymentProviderStripePurchaseStateCommand::PaymentIntentCreatedWithPurchase($event, $paymentIntent, $eventType, PaymentPurchaseData $purchase): void

Add a created purchase status storing the payment intent id.

Returns void

PaymentIntentProcessing

PaymentProviderStripePurchaseStateCommand::PaymentIntentProcessing($event, $paymentIntent, $eventType): void

Handle payment_intent.processing by looking up the purchase via client secret then delegating to the with-purchase handler.

Returns void

PaymentIntentProcessingWithPurchase

PaymentProviderStripePurchaseStateCommand::PaymentIntentProcessingWithPurchase($event, $paymentIntent, $eventType, PaymentPurchaseData $purchase): void

Add a pending purchase status while the payment is processing.

Returns void

PaymentIntentRequiresAction

PaymentProviderStripePurchaseStateCommand::PaymentIntentRequiresAction($event, $paymentIntent, $eventType): void

Handle payment_intent.requires_action by looking up the purchase via client secret then delegating to the with-purchase handler.

Returns void

PaymentIntentRequiresActionWithPurchase

PaymentProviderStripePurchaseStateCommand::PaymentIntentRequiresActionWithPurchase($event, $paymentIntent, $eventType, PaymentPurchaseData $purchase): void

Add a pending purchase status storing the next-action data, such as 3D Secure.

Returns void

PaymentIntentRequiresCapture

PaymentProviderStripePurchaseStateCommand::PaymentIntentRequiresCapture($event, $paymentIntent, $eventType): void

Handle payment_intent.requires_capture by looking up the purchase via client secret then delegating to the with-purchase handler.

Returns void

PaymentIntentRequiresCaptureWithPurchase

PaymentProviderStripePurchaseStateCommand::PaymentIntentRequiresCaptureWithPurchase($event, $paymentIntent, $eventType, PaymentPurchaseData $purchase): void

Add a reserved purchase status, authorized and ready for capture, with the capturable amount.

Returns void

PaymentProviderStripePurchaseTransferCommand

Command handlers for Connect transfer events, invoked by the Connect transfer webhook.

TransferCreated

PaymentProviderStripePurchaseTransferCommand::TransferCreated($event, $transfer, $eventType, $purchase): void

Handle transfer.created by adding a purchase status record with created transfer data including the destination.

Returns void

TransferFailed

PaymentProviderStripePurchaseTransferCommand::TransferFailed($event, $transfer, $eventType, $purchase): void

Handle transfer.failed by adding a purchase status record with failed transfer data and the failure reason.

Returns void

TransferPaid

PaymentProviderStripePurchaseTransferCommand::TransferPaid($event, $transfer, $eventType, $purchase): void

Handle transfer.paid by adding a purchase status record with paid transfer data.

Returns void

TransferReversed

PaymentProviderStripePurchaseTransferCommand::TransferReversed($event, $transfer, $eventType, $purchase): void

Handle transfer.reversed by adding a purchase status record with reversed transfer data.

Returns void

TransferUpdated

PaymentProviderStripePurchaseTransferCommand::TransferUpdated($event, $transfer, $eventType, $purchase): void

Handle transfer.updated by adding a purchase status record with transfer data reflecting the current transfer status.

Returns void

PaymentProviderStripePurchaseWebhook

Registers and dispatches the purchase, state, charge and Connect transfer webhooks.

Handle

PaymentProviderStripePurchaseWebhook::Handle($requestMethod, $requestBody, $headers): void

Register the payment intent succeeded, failed and canceled handlers and dispatch the request through the core webhook handler.

NameTypeDescription
$requestMethodmixedThe HTTP request method.
$requestBodymixedThe raw request body.
$headersmixedThe request headers.

Returns void

HandleCharge

PaymentProviderStripePurchaseWebhook::HandleCharge($requestMethod, $requestBody, $headers): void

Register the charge event handlers (succeeded, failed, refunded, refund updated, dispute created, updated and closed, and updated) and dispatch the request.

NameTypeDescription
$requestMethodmixedThe HTTP request method.
$requestBodymixedThe raw request body.
$headersmixedThe request headers.

Returns void

HandleConnectTransfer

PaymentProviderStripePurchaseWebhook::HandleConnectTransfer($requestMethod, $requestBody, $headers): void

Register the Connect transfer event handlers (created, paid, failed, reversed and updated) and dispatch the request.

NameTypeDescription
$requestMethodmixedThe HTTP request method.
$requestBodymixedThe raw request body.
$headersmixedThe request headers.

Returns void

HandleState

PaymentProviderStripePurchaseWebhook::HandleState($requestMethod, $requestBody, $headers): void

Register the payment intent state-change handlers (created, requires action, processing, requires capture and amount capturable updated) and dispatch the request.

NameTypeDescription
$requestMethodmixedThe HTTP request method.
$requestBodymixedThe raw request body.
$headersmixedThe request headers.

Returns void

PaymentProviderStripeRedirectData

A stored Stripe redirect record.

Properties

NameType
$idint
$memberIdint
$redirectUrlstring|null
$typestring
$createdAtCalendarDateTimeData

__construct

PaymentProviderStripeRedirectData::__construct(int $id = 0, int $memberId = 0, string|null $redirectUrl = null, string $type = '', CalendarDateTimeData $createdAt = new CalendarDateTimeData())

Construct the redirect data object from its field values.

FromJson

PaymentProviderStripeRedirectData::FromJson(string $json): self

Build a redirect data object from its JSON representation.

Returns self The redirect data object.

ToJson

PaymentProviderStripeRedirectData::ToJson(): string

Serialise the redirect data object to JSON.

Returns string The JSON representation.

PaymentProviderStripeRedirectDatabase

Reads and writes Stripe onboarding redirect rows with permalinks.

CreateRedirect

PaymentProviderStripeRedirectDatabase::CreateRedirect(int $memberId, string $type, string|null $redirectUrl = null): string

Create a redirect entry and return its permalink string.

NameTypeDescription
$memberIdintThe member the redirect belongs to.
$typestringThe redirect type, such as return or refresh.
$redirectUrlstring|nullThe redirect URL, or null.

Returns string The redirect permalink.

fromRow

PaymentProviderStripeRedirectDatabase::fromRow(stdClass $row): PaymentProviderStripeRedirectData

Construct the redirect data object from a database row.

NameTypeDescription
$rowstdClassThe raw database row.

Returns PaymentProviderStripeRedirectData The mapped row.

PaymentProviderStripeRedirectDatabase::GetByPermalink(string $permalinkString): PaymentProviderStripeRedirectData

Get redirect data by permalink string.

NameTypeDescription
$permalinkStringstringThe redirect permalink.

Returns PaymentProviderStripeRedirectData The redirect row.

PaymentProviderStripeSetupIntentDatabase

Reads and writes stored Stripe setup intent rows.

fromRow

PaymentProviderStripeSetupIntentDatabase::fromRow(stdClass $row): PaymentProviderStripeSetupIntentRowData

Construct the setup intent row data object from a database row.

NameTypeDescription
$rowstdClassThe raw database row.

Returns PaymentProviderStripeSetupIntentRowData The mapped row.

GetByCustomerId

PaymentProviderStripeSetupIntentDatabase::GetByCustomerId(int $customerId): array

Get setup intents by customer id.

NameTypeDescription
$customerIdintThe customer row id.

Returns array The matching setup intent rows.

GetById

PaymentProviderStripeSetupIntentDatabase::GetById(int $id): PaymentProviderStripeSetupIntentRowData

Get a setup intent by primary id.

NameTypeDescription
$idintThe setup intent row id.

Returns PaymentProviderStripeSetupIntentRowData The setup intent row.

GetByIds

PaymentProviderStripeSetupIntentDatabase::GetByIds(array $ids): array

Bulk-fetch setup intents by an array of ids.

NameTypeDescription
$idsarrayThe setup intent row ids.

Returns array The matching setup intent rows.

GetOptionalByStripeReference

PaymentProviderStripeSetupIntentDatabase::GetOptionalByStripeReference(string $stripeReference): PaymentProviderStripeSetupIntentRowData|null

Get a setup intent by Stripe reference, or null when there is no match.

NameTypeDescription
$stripeReferencestringThe Stripe setup intent reference.

Returns PaymentProviderStripeSetupIntentRowData|null The setup intent row, or null.

Upsert

PaymentProviderStripeSetupIntentDatabase::Upsert(string $stripeReference, int|null $customerId = null, int|null $paymentMethodId = null, string $status = '', string|null $clientSecret = null, string|null $cancellationReason = null, string|null $description = null, string|null $metadata = null, string|null $usage = null): int

Create or update a setup intent record and return its id.

Returns int The setup intent row id.

PaymentProviderStripeSetupIntentRowData

A database row for a stored Stripe SetupIntent.

Properties

NameType
$idint
$stripeReferencestring
$customerIdint|null
$paymentMethodIdint|null
$statusstring
$clientSecretstring|null
$cancellationReasonstring|null
$descriptionstring|null
$metadatastring|null
$usagestring|null
$createdAtCalendarDateTimeData
$lastSyncedAtCalendarDateTimeData|null

__construct

PaymentProviderStripeSetupIntentRowData::__construct(int $id = 0, string $stripeReference = '', int|null $customerId = null, int|null $paymentMethodId = null, string $status = '', string|null $clientSecret = null, string|null $cancellationReason = null, string|null $description = null, string|null $metadata = null, string|null $usage = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData(), CalendarDateTimeData|null $lastSyncedAt = null)

Construct the setup intent row data object from its field values.

FromJson

PaymentProviderStripeSetupIntentRowData::FromJson(string $json): self

Build a setup intent row data object from its JSON representation.

Returns self The setup intent row data object.

ToJson

PaymentProviderStripeSetupIntentRowData::ToJson(): string

Serialise the setup intent row data object to JSON.

Returns string The JSON representation.

PaymentProviderStripeWebhook

The core Stripe webhook handler and command registry. Registers command handlers keyed by Stripe event type and dispatches an incoming webhook to the matching handler after verifying its signature.

Functions

Command

PaymentProviderStripeWebhook::Command(string $commandName, callable $handler): void

Register a command handler keyed by Stripe event type into the static command registry.

NameTypeDescription
$commandNamestringThe Stripe event type to handle.
$handlercallableThe handler invoked for the event.

Returns void

Handle

PaymentProviderStripeWebhook::Handle(string $requestMethod, string $requestBody, array $headers, string $webhookSecret, string $logIdentifier, callable $commandsCallback, ?callable $objectExtractor = null, ?callable $objectValidator = null, ?string $fromJsonFunction = null): void

Reset the registry, validate the POST, normalise headers, verify the Stripe signature, decode the JSON, invoke the commands callback to register handlers, extract and validate the event object, and route to the matching handler, writing HTTP responses.

NameTypeDescription
$requestMethodstringThe HTTP request method.
$requestBodystringThe raw request body.
$headersarrayThe request headers.
$webhookSecretstringThe Stripe webhook signing secret.
$logIdentifierstringAn identifier used in log entries.
$commandsCallbackcallableA callback that registers the event handlers.
$objectExtractor?callableA deprecated extractor for the event object, or null.
$objectValidator?callableA deprecated validator for the event object, or null.
$fromJsonFunction?stringA callable name that parses the event JSON, or null.

Returns void