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.
extraFields() (opens new window) Returns the list of additional fields that can be returned by toArray() (opens new window) in addition to those listed in fields() (opens new window).
fields() (opens new window) Returns the list of fields that should be returned by default by toArray() (opens new window) when no specific fields are specified.
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.
instance() (opens new window) Returns static class instance, which can be used to obtain meta information.
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.
toArray() (opens new window) Converts the object into an array.

# cancelSubscription()

Cancels a subscription.

View source (opens new window)

Arguments

Throws

# getBillingIssueDescription()

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

View source (opens new window)

Arguments

  • $subscription

# getBillingIssueResolveFormHtml()

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

View source (opens new window)

Arguments

  • $subscription

# getHasBillingIssues()

Returns whether this subscription has billing issues.

View source (opens new window)

Arguments

  • $subscription

# getNextPaymentAmount()

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

View source (opens new window)

Arguments

  • $subscription

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

  • $subscription

Returns

craft\commerce\models\subscriptions\SubscriptionPayment[]

# getSubscriptionPlanByReference()

Returns a subscription plan by its reference

View source (opens new window)

Arguments

  • $reference

# getSubscriptionPlans()

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

View source (opens new window)

# reactivateSubscription()

Reactivates a subscription.

View source (opens new window)

Arguments

Throws

# refreshPaymentHistory()

Refresh the subscription payment history for a given subscription.

View source (opens new window)

Arguments

  • $subscription

# subscribe()

Subscribe user to a plan.

View source (opens new window)

Arguments

Throws

# supportsPlanSwitch()

Returns whether this gateway supports switching plans.

View source (opens new window)

# supportsReactivation()

Returns whether this gateway supports reactivating subscriptions.

View source (opens new window)

# switchSubscriptionPlan()

Switch a subscription to a different subscription plan.

View source (opens new window)

Arguments