SubscriptionGatewayInterface

Type
Interface
Namespace
craft\commerce\base
Extends
craft\base\SavableComponentInterface (opens new window)
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 (opens new window)

# Public Methods

Method Description
afterDelete() (opens new window) Performs actions after a component is deleted.
afterSave() (opens new window) Performs actions after a component is saved.
beforeApplyDelete() (opens new window) Performs actions before a component delete is applied to the database.
beforeDelete() (opens new window) Performs actions before a component is deleted.
beforeSave() (opens new window) Performs actions before a component is saved.
cancelSubscription() Cancels a subscription.
displayName() (opens new window) 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() (opens new window) Returns whether the component is new (unsaved).
getNextPaymentAmount() Returns the next payment amount for a subscription, taking into account all discounts.
getSettings() (opens new window) Returns an array of the component’s settings.
getSettingsHtml() (opens new window) 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() (opens new window) 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() (opens new window) 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() (opens new window) Validates the component.

# cancelSubscription()

Cancels a subscription.

View source (opens new window)

Arguments

Returns

craft\commerce\base\SubscriptionResponseInterface

Throws

# getBillingIssueDescription()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getBillingIssueResolveFormHtml()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getHasBillingIssues()

Returns whether this subscription has billing issues.

View source (opens new window)

Arguments

Returns

boolean (opens new window)

# getNextPaymentAmount()

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

View source (opens new window)

Arguments

Returns

string (opens new window) – Next payment amount with currency code

# getSubscriptionPayments()

Returns a list of subscription payments for a given subscription.

View source (opens new window)

Arguments

Returns

craft\commerce\models\subscriptions\SubscriptionPayment[]

# getSubscriptionPlanByReference()

Returns a subscription plan by its reference

View source (opens new window)

Arguments

Returns

string (opens new window)

# getSubscriptionPlans()

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

View source (opens new window)

Returns

array (opens new window)

# reactivateSubscription()

Reactivates a subscription.

View source (opens new window)

Arguments

Returns

craft\commerce\base\SubscriptionResponseInterface

Throws

# refreshPaymentHistory()

Refresh the subscription payment history for a given subscription.

View source (opens new window)

Arguments

# subscribe()

Subscribe user to a plan.

View source (opens new window)

Arguments

Returns

craft\commerce\base\SubscriptionResponseInterface

Throws

# supportsPlanSwitch()

Returns whether this gateway supports switching plans.

View source (opens new window)

Returns

boolean (opens new window)

# supportsReactivation()

Returns whether this gateway supports reactivating subscriptions.

View source (opens new window)

Returns

boolean (opens new window)

# switchSubscriptionPlan()

Switch a subscription to a different subscription plan.

View source (opens new window)

Arguments

Returns

craft\commerce\base\SubscriptionResponseInterface