SubscriptionGatewayInterface

Type
Interface
Namespace
craft\commerce\base
Extends
craft\base\SavableComponentInterface
Implemented by
craft\commerce\base\SubscriptionGateway, craft\commerce\gateways\Dummy
Since
2.0

SubscriptionGatewayInterface defines the common interface to be implemented by gateway classes that support subscriptions.

View source

# Public Methods

Method Description
afterDelete() Performs actions after a component is deleted.
afterSave() Performs actions after a component is saved.
beforeApplyDelete() Performs actions before a component delete is applied to the database.
beforeDelete() Performs actions before a component is deleted.
beforeSave() Performs actions before a component is saved.
cancelSubscription() Cancels a subscription.
displayName() Returns the display name of this class.
getBillingIssueDescription() Return a description of the billing issue (if any) with this subscription.
getBillingIssueResolveFormHtml() Return the form HTML for resolving the billing issue (if any) with this subscription.
getHasBillingIssues() Returns whether this subscription has billing issues.
getIsNew() Returns whether the component is new (unsaved).
getNextPaymentAmount() Returns the next payment amount for a subscription, taking into account all discounts.
getSettings() Returns an array of the component’s settings.
getSettingsHtml() Returns the component’s settings HTML.
getSubscriptionPayments() Returns a list of subscription payments for a given subscription.
getSubscriptionPlanByReference() Returns a subscription plan by its reference
getSubscriptionPlans() Returns all subscription plans as array containing hashes with reference and name as keys.
isSelectable() Returns whether the component should be selectable in component Type selects.
reactivateSubscription() Reactivates a subscription.
refreshPaymentHistory() Refresh the subscription payment history for a given subscription.
settingsAttributes() Returns the list of settings attribute names.
subscribe() Subscribe user to a plan.
supportsPlanSwitch() Returns whether this gateway supports switching plans.
supportsReactivation() Returns whether this gateway supports reactivating subscriptions.
switchSubscriptionPlan() Switch a subscription to a different subscription plan.
validate() Validates the component.

# cancelSubscription()

Cancels a subscription.

View source

Arguments

Returns

craft\commerce\base\SubscriptionResponseInterface

Throws

# getBillingIssueDescription()

Return a description of the billing issue (if any) with this subscription.

View source

Arguments

Returns

string

# getBillingIssueResolveFormHtml()

Return the form HTML for resolving the billing issue (if any) with this subscription.

View source

Arguments

Returns

string

# getHasBillingIssues()

Returns whether this subscription has billing issues.

View source

Arguments

Returns

boolean

# getNextPaymentAmount()

Returns the next payment amount for a subscription, taking into account all discounts.

View source

Arguments

Returns

string – Next payment amount with currency code

# getSubscriptionPayments()

Returns a list of subscription payments for a given subscription.

View source

Arguments

Returns

craft\commerce\models\subscriptions\SubscriptionPayment[]

# getSubscriptionPlanByReference()

Returns a subscription plan by its reference

View source

Arguments

Returns

string

# getSubscriptionPlans()

Returns all subscription plans as array containing hashes with reference and name as keys.

View source

Returns

array

# reactivateSubscription()

Reactivates a subscription.

View source

Arguments

Returns

craft\commerce\base\SubscriptionResponseInterface

Throws

# refreshPaymentHistory()

Refresh the subscription payment history for a given subscription.

View source

Arguments

# subscribe()

Subscribe user to a plan.

View source

Arguments

Returns

craft\commerce\base\SubscriptionResponseInterface

Throws

# supportsPlanSwitch()

Returns whether this gateway supports switching plans.

View source

Returns

boolean

# supportsReactivation()

Returns whether this gateway supports reactivating subscriptions.

View source

Returns

boolean

# switchSubscriptionPlan()

Switch a subscription to a different subscription plan.

View source

Arguments

Returns

craft\commerce\base\SubscriptionResponseInterface