Payment

Reference for the Payment module: format amounts held in millipennies as a currency string, configure a small set of products and subscriptions, and read and write the database records for purchases, subscriptions and merchants along with their status history.

This page is a pure reference. For how the framework fits together, see the Guide.

Classes

Payment

The module's entry point: a routing hook and a helper that formats an amount in millipennies as a currency string using integer maths, avoiding floating point rounding.

FormatMillipennies

Payment::FormatMillipennies(int $millipennies, string $currency = 'GBP'): string

Formats millipennies (1000 units = 1 penny) as a currency string. Uses text processing on an integer to avoid float rounding issues.

NameTypeDescription
$millipenniesintThe amount in millipennies (1000 = 1 penny, 100000 = 1 pound or dollar).
$currencystringThe currency code, for example GBP or USD.

Returns string The formatted currency string.

Route

Payment::Route(): void

Routing entry point for the module. Webhooks are handled by provider modules, so this performs no routing.

Returns void

PaymentConfig

Where a site configures its products and subscriptions. Designed for a small set of rarely changing products and subscriptions; a full product database is not supported. Registered subscriptions, settings and providers are collected in public static arrays.

Constants

ConstantValueDescription
PaymentConfig::PAYMENT_SANDBOXtrueWhether the sandbox keys are used.
PaymentConfig::PAYMENT_PUBLIC_KEYstringThe provider public key, chosen by the sandbox flag.
PaymentConfig::PAYMENT_PRIVATE_KEYstringThe provider private key, chosen by the sandbox flag.
PaymentConfig::ENDPOINT_SECRETstringThe webhook endpoint signing secret.

Properties

PropertyTypeDescription
PaymentConfig::$subscriptionsarrayRegistered subscriptions, keyed by subscription name.
PaymentConfig::$settingsarrayRegistered settings, keyed by name.
PaymentConfig::$providersarrayRegistered providers, keyed by provider name.

AddProvider

PaymentConfig::AddProvider(string $providerName, string $displayName): void

Registers a payment provider.

NameTypeDescription
$providerNamestringThe name of the provider, for example stripe or paypal.
$displayNamestringThe display name, for example Stripe or PayPal.

Returns void

AddSetting

PaymentConfig::AddSetting(string $name, string $defaultValue): void

Registers a named setting with a default value.

NameTypeDescription
$namestringThe setting name.
$defaultValuestringThe default value for the setting.

Returns void

Subscription

PaymentConfig::Subscription(string $subscriptionName, string $subscriptionTitle, string $subscriptionReference, array $price, callable|string $onCreate, callable|string $onSuccess, callable|string $onRecurrence): void

Registers a subscription option with its price and lifecycle callbacks.

NameTypeDescription
$subscriptionNamestringThe unique key for the subscription.
$subscriptionTitlestringThe subscription title.
$subscriptionReferencestringThe subscription reference.
$pricearrayThe subscription price.
$onCreatecallable|stringCallback invoked when the subscription is created.
$onSuccesscallable|stringCallback invoked on a successful payment.
$onRecurrencecallable|stringCallback invoked on a recurring payment.

Returns void

PaymentMerchantData

Immutable data for a payment merchant record, with helpers to encode to and decode from JSON.

Properties

PropertyTypeDescription
$data->idintThe merchant record id (readonly).
$data->providerIdentifierstringThe provider identifier (readonly).
$data->memberId?intThe owning member id, or null (readonly).
$data->providerAccountRef?stringThe provider account reference, or null (readonly).
$data->providerDataJson?stringProvider-specific data JSON, or null (readonly).
$data->createdAtCalendarDateTimeDataWhen the record was created (readonly).

__construct

new PaymentMerchantData(int $id = 0, string $providerIdentifier = '', ?int $memberId = null, ?string $providerAccountRef = null, ?string $providerDataJson = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData())

Create merchant data from its fields.

NameTypeDescription
$idintThe merchant record id.
$providerIdentifierstringThe provider identifier.
$memberId?intThe owning member id, or null.
$providerAccountRef?stringThe provider account reference, or null.
$providerDataJson?stringProvider-specific data JSON, or null.
$createdAtCalendarDateTimeDataWhen the record was created.

Returns PaymentMerchantData

FromJson

PaymentMerchantData::FromJson(string $json): self

Build merchant data from its JSON representation.

NameTypeDescription
$jsonstringThe JSON string.

Returns self The merchant data.

ToJson

$data->ToJson(): string

The merchant data encoded as a JSON string.

Returns string The JSON string.

PaymentMerchantDatabase

Database operations for payment merchants: read merchants, append status history and update provider account flags.

Constants

ConstantValueDescription
PaymentMerchantDatabase::MERCHANT_STATUS_PENDING0Merchant is pending.
PaymentMerchantDatabase::MERCHANT_STATUS_ACTIVE1Merchant is active.
PaymentMerchantDatabase::MERCHANT_STATUS_RESTRICTED2Merchant is restricted.
PaymentMerchantDatabase::MERCHANT_STATUS_REJECTED3Merchant is rejected.
PaymentMerchantDatabase::MERCHANT_STATUS_SUSPENDED4Merchant is suspended.

AddStatus

PaymentMerchantDatabase::AddStatus(int $merchantId, int $statusType, ?string $displayDetails = null, ?string $statusDataJson = null): void

Add a status history record for a merchant.

NameTypeDescription
$merchantIdintMerchant id.
$statusTypeintStatus type constant.
$displayDetails?stringHuman-readable status details, or null.
$statusDataJson?stringAdditional status data JSON, or null.

Returns void

fromRow

PaymentMerchantDatabase::fromRow(object $row): PaymentMerchantData

Convert a database row to a merchant data object.

NameTypeDescription
$rowobjectDatabase row.

Returns PaymentMerchantData The merchant data.

GetByProviderAccountRef

PaymentMerchantDatabase::GetByProviderAccountRef(string $accountRef): PaymentMerchantData

Get a merchant by provider account reference.

NameTypeDescription
$accountRefstringProvider account reference, for example a Stripe account id.

Returns PaymentMerchantData The merchant data.

UpdateStripeAccountFlags

PaymentMerchantDatabase::UpdateStripeAccountFlags(int $merchantId, bool $chargesEnabled, bool $payoutsEnabled, bool $detailsSubmitted, bool $tosAccepted, bool $externalAccountAdded): void

Update the Stripe account flags stored in a merchant's provider data.

NameTypeDescription
$merchantIdintMerchant id.
$chargesEnabledboolWhether charges are enabled.
$payoutsEnabledboolWhether payouts are enabled.
$detailsSubmittedboolWhether details have been submitted.
$tosAcceptedboolWhether terms of service have been accepted.
$externalAccountAddedboolWhether an external account has been added.

Returns void

UpdateStripeExternalAccountStatus

PaymentMerchantDatabase::UpdateStripeExternalAccountStatus(int $merchantId, bool $externalAccountAdded): void

Update the Stripe external account status stored in a merchant's provider data.

NameTypeDescription
$merchantIdintMerchant id.
$externalAccountAddedboolWhether an external account has been added.

Returns void

PaymentMerchantStatusData

Immutable data for a merchant status history record, with helpers to encode to and decode from JSON.

Properties

PropertyTypeDescription
$data->idintThe status record id (readonly).
$data->merchantIdintThe merchant id this status belongs to (readonly).
$data->statusTypeintThe status type constant (readonly).
$data->displayDetails?stringHuman-readable status details, or null (readonly).
$data->providerRef?stringProvider reference, or null (readonly).
$data->providerDataJson?stringProvider-specific data JSON, or null (readonly).
$data->createdAtCalendarDateTimeDataWhen the record was created (readonly).

__construct

new PaymentMerchantStatusData(int $id = 0, int $merchantId = 0, int $statusType = 0, ?string $displayDetails = null, ?string $providerRef = null, ?string $providerDataJson = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData())

Create merchant status data from its fields.

NameTypeDescription
$idintThe status record id.
$merchantIdintThe merchant id this status belongs to.
$statusTypeintThe status type constant.
$displayDetails?stringHuman-readable status details, or null.
$providerRef?stringProvider reference, or null.
$providerDataJson?stringProvider-specific data JSON, or null.
$createdAtCalendarDateTimeDataWhen the record was created.

Returns PaymentMerchantStatusData

FromJson

PaymentMerchantStatusData::FromJson(string $json): self

Build merchant status data from its JSON representation.

NameTypeDescription
$jsonstringThe JSON string.

Returns self The merchant status data.

ToJson

$data->ToJson(): string

The merchant status data encoded as a JSON string.

Returns string The JSON string.

PaymentProviderPaymentStatusEnum

The outcome of a payment as reported by a payment provider. A backed enum with integer values.

Cases

CaseValueDescription
PaymentProviderPaymentStatusEnum::SUCCESS1The payment succeeded.
PaymentProviderPaymentStatusEnum::PENDING2The payment is pending.
PaymentProviderPaymentStatusEnum::ERROR3The payment failed.
PaymentProviderPaymentStatusEnum::UNKNOWN4The payment outcome is unknown.

PaymentPurchaseData

Immutable data for a purchase record, with helpers to encode to and decode from JSON.

Properties

PropertyTypeDescription
$data->idintThe purchase record id (readonly).
$data->providerIdentifierstringThe provider identifier (readonly).
$data->memberId?intThe owning member id, or null (readonly).
$data->moduleNamestringThe module that created the purchase (readonly).
$data->typeIdentifierstringThe purchase type identifier (readonly).
$data->currencystringThe currency code (readonly).
$data->amountMillipenniesintThe amount in millipennies (readonly).
$data->titlestringThe purchase title (readonly).
$data->displayDetailsstringDisplay details (readonly).
$data->dataJsonstringModule-specific data JSON (readonly).
$data->successUrlstringThe success URL (readonly).
$data->productDataJson?stringProduct data JSON, or null (readonly).
$data->providerDataJson?stringProvider-specific data JSON, or null (readonly).
$data->createdAtCalendarDateTimeDataWhen the record was created (readonly).

__construct

new PaymentPurchaseData(int $id = 0, string $providerIdentifier = '', ?int $memberId = null, string $moduleName = '', string $typeIdentifier = '', string $currency = '', int $amountMillipennies = 0, string $title = '', string $displayDetails = '', string $dataJson = '', string $successUrl = '', ?string $productDataJson = null, ?string $providerDataJson = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData())

Create purchase data from its fields.

NameTypeDescription
$idintThe purchase record id.
$providerIdentifierstringThe provider identifier.
$memberId?intThe owning member id, or null.
$moduleNamestringThe module that created the purchase.
$typeIdentifierstringThe purchase type identifier.
$currencystringThe currency code.
$amountMillipenniesintThe amount in millipennies.
$titlestringThe purchase title.
$displayDetailsstringDisplay details.
$dataJsonstringModule-specific data JSON.
$successUrlstringThe success URL.
$productDataJson?stringProduct data JSON, or null.
$providerDataJson?stringProvider-specific data JSON, or null.
$createdAtCalendarDateTimeDataWhen the record was created.

Returns PaymentPurchaseData

FromJson

PaymentPurchaseData::FromJson(string $json): self

Build purchase data from its JSON representation.

NameTypeDescription
$jsonstringThe JSON string.

Returns self The purchase data.

ToJson

$data->ToJson(): string

The purchase data encoded as a JSON string.

Returns string The JSON string.

PaymentPurchaseDatabase

Database operations for payment purchases: create and read purchases, look them up by provider references, and append status history.

Constants

ConstantValueDescription
PaymentPurchaseDatabase::PURCHASE_STATUS_CREATED0Purchase has been created.
PaymentPurchaseDatabase::PURCHASE_STATUS_RESERVED1Purchase has been reserved.
PaymentPurchaseDatabase::PURCHASE_STATUS_PENDING2Purchase is pending.
PaymentPurchaseDatabase::PURCHASE_STATUS_SUCCESS3Purchase succeeded.
PaymentPurchaseDatabase::PURCHASE_STATUS_ERROR4Purchase failed.
PaymentPurchaseDatabase::PURCHASE_STATUS_CANCELLED5Purchase was cancelled.

AddStatus

PaymentPurchaseDatabase::AddStatus(int $purchaseId, int $statusType, ?string $displayDetails = null, ?string $statusDataJson = null): void

Add a status history record for a purchase.

NameTypeDescription
$purchaseIdintPurchase id.
$statusTypeintStatus type constant.
$displayDetails?stringHuman-readable status details, or null.
$statusDataJson?stringAdditional status data JSON, or null.

Returns void

Create

PaymentPurchaseDatabase::Create(string $providerIdentifier, ?int $optionalMemberId, string $moduleName, string $typeIdentifier, string $currency, int $amountMillipennies, string $title, string $displayDetails, string $dataJson, string $successUrl, ?string $optionalProductDataJson = null, ?string $optionalProviderDataJson = null): int

Create a new payment purchase record.

NameTypeDescription
$providerIdentifierstringProvider identifier, for example stripe.
$optionalMemberId?intOptional member id.
$moduleNamestringModule name.
$typeIdentifierstringType identifier.
$currencystringCurrency code.
$amountMillipenniesintAmount in millipennies.
$titlestringPurchase title.
$displayDetailsstringDisplay details.
$dataJsonstringModule-specific data JSON.
$successUrlstringSuccess URL.
$optionalProductDataJson?stringOptional product data JSON.
$optionalProviderDataJson?stringOptional provider data JSON.

Returns int The purchase id.

fromRow

PaymentPurchaseDatabase::fromRow(object $row): PaymentPurchaseData

Convert a database row to a purchase data object.

NameTypeDescription
$rowobjectDatabase row.

Returns PaymentPurchaseData The purchase data.

GetByClientSecret

PaymentPurchaseDatabase::GetByClientSecret(string $clientSecret): PaymentPurchaseData

Get a purchase by client secret, matching the payment intent id extracted from it against the provider data JSON.

NameTypeDescription
$clientSecretstringClient secret.

Returns PaymentPurchaseData The purchase data.

GetByProviderPaymentRef

PaymentPurchaseDatabase::GetByProviderPaymentRef(string $paymentRef): PaymentPurchaseData

Get a purchase by provider payment reference.

NameTypeDescription
$paymentRefstringProvider payment reference, for example a PaymentIntent id or Charge id.

Returns PaymentPurchaseData The purchase data.

GetByProviderToRef

PaymentPurchaseDatabase::GetByProviderToRef(string $toRef): array

Get purchases whose provider data JSON holds the given transfer reference.

NameTypeDescription
$toRefstringProvider "to" reference, for example a Transfer id.

Returns array A list of PaymentPurchaseData.

GetOptionalByRideId

PaymentPurchaseDatabase::GetOptionalByRideId(int $rideId): ?PaymentPurchaseData

Get the most recent ride payment purchase for a ride id, or null when there is none.

NameTypeDescription
$rideIdintThe ride id.

Returns ?PaymentPurchaseData The purchase data, or null.

UpdateAmountAndProviderData

PaymentPurchaseDatabase::UpdateAmountAndProviderData(int $purchaseId, int $amountMillipennies, ?string $optionalProviderDataJson = null): void

Update a purchase's amount and, when given, its provider data JSON.

NameTypeDescription
$purchaseIdintPurchase id.
$amountMillipenniesintNew amount in millipennies.
$optionalProviderDataJson?stringOptional provider data JSON.

Returns void

UpdateProviderPaymentRef

PaymentPurchaseDatabase::UpdateProviderPaymentRef(int $purchaseId, string $paymentRef): void

Update the provider payment reference for a purchase.

NameTypeDescription
$purchaseIdintPurchase id.
$paymentRefstringProvider payment reference.

Returns void

PaymentPurchaseStatusData

Immutable data for a purchase status history record, with helpers to encode to and decode from JSON.

Properties

PropertyTypeDescription
$data->idintThe status record id (readonly).
$data->purchaseIdintThe purchase id this status belongs to (readonly).
$data->statusTypeintThe status type constant (readonly).
$data->displayDetails?stringHuman-readable status details, or null (readonly).
$data->providerRef?stringProvider reference, or null (readonly).
$data->providerDataJson?stringProvider-specific data JSON, or null (readonly).
$data->createdAtCalendarDateTimeDataWhen the record was created (readonly).

__construct

new PaymentPurchaseStatusData(int $id = 0, int $purchaseId = 0, int $statusType = 0, ?string $displayDetails = null, ?string $providerRef = null, ?string $providerDataJson = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData())

Create purchase status data from its fields.

NameTypeDescription
$idintThe status record id.
$purchaseIdintThe purchase id this status belongs to.
$statusTypeintThe status type constant.
$displayDetails?stringHuman-readable status details, or null.
$providerRef?stringProvider reference, or null.
$providerDataJson?stringProvider-specific data JSON, or null.
$createdAtCalendarDateTimeDataWhen the record was created.

Returns PaymentPurchaseStatusData

FromJson

PaymentPurchaseStatusData::FromJson(string $json): self

Build purchase status data from its JSON representation.

NameTypeDescription
$jsonstringThe JSON string.

Returns self The purchase status data.

ToJson

$data->ToJson(): string

The purchase status data encoded as a JSON string.

Returns string The JSON string.

PaymentRegularityEnum

The billing regularity of a subscription. A backed enum with integer values, plus a helper to build a case from its value.

Cases

CaseValueDescription
PaymentRegularityEnum::DAILY1Billed daily.
PaymentRegularityEnum::WEEKLY2Billed weekly.
PaymentRegularityEnum::MONTHLY3Billed monthly.
PaymentRegularityEnum::QUARTERLY4Billed quarterly.
PaymentRegularityEnum::YEARLY5Billed yearly.
Functions

fromValue

PaymentRegularityEnum::fromValue(int $value): self

Return the case with the given integer value, throwing when no case matches.

NameTypeDescription
$valueintThe integer value of the case.

Returns self The matching case.

PaymentSubscriptionData

Immutable data for a subscription record, with helpers to encode to and decode from JSON.

Properties

PropertyTypeDescription
$data->idintThe subscription record id (readonly).
$data->providerIdentifierstringThe provider identifier (readonly).
$data->memberId?intThe owning member id, or null (readonly).
$data->currencystringThe currency code (readonly).
$data->amountMillipenniesintThe amount in millipennies per period (readonly).
$data->modulestringThe module that created the subscription (readonly).
$data->identifierstringThe subscription identifier within the module (readonly).
$data->titlestringThe subscription title (readonly).
$data->humanReadableDetailstringHuman-readable detail text (readonly).
$data->priceDescriptionstringDescription of the subscription price (readonly).
$data->regularityintRegularity enum value (readonly).
$data->providerRefstringProvider reference (readonly).
$data->providerDataJson?stringProvider-specific data JSON, or null (readonly).
$data->createdAtCalendarDateTimeDataWhen the record was created (readonly).

__construct

new PaymentSubscriptionData(int $id = 0, string $providerIdentifier = '', ?int $memberId = null, string $currency = '', int $amountMillipennies = 0, string $module = '', string $identifier = '', string $title = '', string $humanReadableDetail = '', string $priceDescription = '', int $regularity = 0, string $providerRef = '', ?string $providerDataJson = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData())

Create subscription data from its fields.

NameTypeDescription
$idintThe subscription record id.
$providerIdentifierstringThe provider identifier.
$memberId?intThe owning member id, or null.
$currencystringThe currency code.
$amountMillipenniesintThe amount in millipennies per period.
$modulestringThe module that created the subscription.
$identifierstringThe subscription identifier within the module.
$titlestringThe subscription title.
$humanReadableDetailstringHuman-readable detail text.
$priceDescriptionstringDescription of the subscription price.
$regularityintRegularity enum value.
$providerRefstringProvider reference.
$providerDataJson?stringProvider-specific data JSON, or null.
$createdAtCalendarDateTimeDataWhen the record was created.

Returns PaymentSubscriptionData

FromJson

PaymentSubscriptionData::FromJson(string $json): self

Build subscription data from its JSON representation.

NameTypeDescription
$jsonstringThe JSON string.

Returns self The subscription data.

ToJson

$data->ToJson(): string

The subscription data encoded as a JSON string.

Returns string The JSON string.

PaymentSubscriptionDatabase

Database operations for payment subscriptions: create and read subscriptions, look them up by provider reference, append status history and update provider data.

Constants

ConstantValueDescription
PaymentSubscriptionDatabase::SUBSCRIPTION_STATUS_PENDING0Subscription is pending.
PaymentSubscriptionDatabase::SUBSCRIPTION_STATUS_ACTIVE1Subscription is active.
PaymentSubscriptionDatabase::SUBSCRIPTION_STATUS_TRIALING2Subscription is in a trial.
PaymentSubscriptionDatabase::SUBSCRIPTION_STATUS_PAST_DUE3Subscription is past due.
PaymentSubscriptionDatabase::SUBSCRIPTION_STATUS_UNPAID4Subscription is unpaid.
PaymentSubscriptionDatabase::SUBSCRIPTION_STATUS_CANCELLED5Subscription was cancelled.

AddStatus

PaymentSubscriptionDatabase::AddStatus(int $subscriptionId, int $statusType, ?string $displayDetails = null, ?string $statusDataJson = null): void

Add a status history record for a subscription.

NameTypeDescription
$subscriptionIdintSubscription id.
$statusTypeintStatus type constant.
$displayDetails?stringHuman-readable status details, or null.
$statusDataJson?stringAdditional status data JSON, or null.

Returns void

Create

PaymentSubscriptionDatabase::Create(string $providerIdentifier, ?int $memberId, string $module, string $identifier, string $title, string $humanReadableDetail, string $currency, int $amountMillipennies, string $priceDescription, int $regularity, string $providerRef, object $providerData): int

Create a new subscription and record its initial pending status.

NameTypeDescription
$providerIdentifierstringProvider identifier, for example stripe.
$memberId?intOptional member id.
$modulestringModule name that created the subscription.
$identifierstringSubscription identifier within the module.
$titlestringSubscription title.
$humanReadableDetailstringHuman-readable detail text.
$currencystringCurrency code.
$amountMillipenniesintAmount in millipennies per billing period.
$priceDescriptionstringDescription of the subscription price.
$regularityintRegularity enum value.
$providerRefstringProvider reference.
$providerDataobjectProvider-specific data object with a ToJson method.

Returns int The subscription id.

fromRow

PaymentSubscriptionDatabase::fromRow(object $row): PaymentSubscriptionData

Convert a database row to a subscription data object.

NameTypeDescription
$rowobjectDatabase row.

Returns PaymentSubscriptionData The subscription data.

GetByProviderRef

PaymentSubscriptionDatabase::GetByProviderRef(string $providerRef): PaymentSubscriptionData

Get a subscription by provider reference.

NameTypeDescription
$providerRefstringProvider reference, for example a Stripe subscription id.

Returns PaymentSubscriptionData The subscription data.

UpdateStripeProviderData

PaymentSubscriptionDatabase::UpdateStripeProviderData(int $subscriptionId, string $providerRef, object $stripeProviderData): void

Update both the provider reference and the provider data JSON for a subscription.

NameTypeDescription
$subscriptionIdintSubscription id.
$providerRefstringProvider reference, for example a Stripe subscription id.
$stripeProviderDataobjectProvider data object with a ToJson method.

Returns void

PaymentSubscriptionStatusData

Immutable data for a subscription status history record, with helpers to encode to and decode from JSON.

Properties

PropertyTypeDescription
$data->idintThe status record id (readonly).
$data->subscriptionIdintThe subscription id this status belongs to (readonly).
$data->statusTypeintThe status type constant (readonly).
$data->displayDetails?stringHuman-readable status details, or null (readonly).
$data->providerRef?stringProvider reference, or null (readonly).
$data->providerDataJson?stringProvider-specific data JSON, or null (readonly).
$data->createdAtCalendarDateTimeDataWhen the record was created (readonly).

__construct

new PaymentSubscriptionStatusData(int $id = 0, int $subscriptionId = 0, int $statusType = 0, ?string $displayDetails = null, ?string $providerRef = null, ?string $providerDataJson = null, CalendarDateTimeData $createdAt = new CalendarDateTimeData())

Create subscription status data from its fields.

NameTypeDescription
$idintThe status record id.
$subscriptionIdintThe subscription id this status belongs to.
$statusTypeintThe status type constant.
$displayDetails?stringHuman-readable status details, or null.
$providerRef?stringProvider reference, or null.
$providerDataJson?stringProvider-specific data JSON, or null.
$createdAtCalendarDateTimeDataWhen the record was created.

Returns PaymentSubscriptionStatusData

FromJson

PaymentSubscriptionStatusData::FromJson(string $json): self

Build subscription status data from its JSON representation.

NameTypeDescription
$jsonstringThe JSON string.

Returns self The subscription status data.

ToJson

$data->ToJson(): string

The subscription status data encoded as a JSON string.

Returns string The JSON string.