SubscriptionGatewayInterface ​
- Type
- Interface
- Namespace
- craft\commerce\base
- Extends
- craft\commerce\base\GatewayInterface
- 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.
Public Methods ​
Method | Description |
---|---|
afterDelete() | Performs actions after a component is deleted. |
afterSave() | Performs actions after a component is saved. |
authorize() | Makes an authorize request. |
availableForUseWithOrder() | Returns true if gateway supports payments for the supplied order. |
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. |
capture() | Makes a capture request. |
completeAuthorize() | Complete the authorization for offsite payments. |
completePurchase() | Complete the purchase for offsite payments. |
createPaymentSource() | Creates a payment source from source data and customer id. |
deletePaymentSource() | Deletes a payment source on the gateway by its token. |
displayName() | Returns the display name of this class. |
extraFields() | Returns the list of additional fields that can be returned by toArray() in addition to those listed in fields(). |
fields() | Returns the list of fields that should be returned by default by toArray() 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() | Returns whether the component is new (unsaved). |
getNextPaymentAmount() | Returns the next payment amount for a subscription, taking into account all discounts. |
getPaymentFormModel() | Returns payment form model to use in payment forms. |
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. |
getTransactionHashFromWebhook() | Retrieves the transaction hash from the webhook data. This could be a query string param or part of the response data. |
instance() | Returns static class instance, which can be used to obtain meta information. |
isSelectable() | Returns whether the component should be selectable in component Type selects. |
processWebHook() | Processes a webhook and return a response |
purchase() | Makes a purchase request. |
reactivateSubscription() | Reactivates a subscription. |
refreshPaymentHistory() | Refresh the subscription payment history for a given subscription. |
refund() | Makes an refund request. |
settingsAttributes() | Returns the list of settings attribute names. |
subscribe() | Subscribe user to a plan. |
supportsAuthorize() | Returns true if gateway supports authorize requests. |
supportsCapture() | Returns true if gateway supports capture requests. |
supportsCompleteAuthorize() | Returns true if gateway supports completing authorize requests |
supportsCompletePurchase() | Returns true if gateway supports completing purchase requests |
supportsPartialPayment() | Returns true if gateway supports partial payment requests. |
supportsPartialRefund() | Returns true if gateway supports partial refund requests. |
supportsPaymentSources() | Returns true if gateway supports storing payment sources |
supportsPlanSwitch() | Returns whether this gateway supports switching plans. |
supportsPurchase() | Returns true if gateway supports purchase requests. |
supportsReactivation() | Returns whether this gateway supports reactivating subscriptions. |
supportsRefund() | Returns true if gateway supports refund requests. |
supportsWebhooks() | Returns true if gateway supports webhooks. |
switchSubscriptionPlan() | Switch a subscription to a different subscription plan. |
toArray() | Converts the object into an array. |
cancelSubscription()
​
Cancels a subscription.
Arguments ​
$subscription
(craft\commerce\elements\Subscription) – The subscription to cancel$parameters
(craft\commerce\models\subscriptions\CancelSubscriptionForm) – Additional parameters to use
Throws ​
- craft\commerce\errors\SubscriptionException
for all subscription-related errors.
getBillingIssueDescription()
​
Return a description of the billing issue (if any) with this subscription.
Arguments ​
$subscription
getBillingIssueResolveFormHtml()
​
Return the form HTML for resolving the billing issue (if any) with this subscription.
Arguments ​
$subscription
getHasBillingIssues()
​
Returns whether this subscription has billing issues.
Arguments ​
$subscription
getNextPaymentAmount()
​
Returns the next payment amount for a subscription, taking into account all discounts.
Arguments ​
$subscription
Returns ​
string – Next payment amount with currency code
getSubscriptionPayments()
​
Returns a list of subscription payments for a given subscription.
Arguments ​
$subscription
Returns ​
craft\commerce\models\subscriptions\SubscriptionPayment[]
getSubscriptionPlanByReference()
​
Returns a subscription plan by its reference
Arguments ​
$reference
getSubscriptionPlans()
​
Returns all subscription plans as array containing hashes with reference
and name
as keys.
reactivateSubscription()
​
Reactivates a subscription.
Arguments ​
$subscription
(craft\commerce\elements\Subscription) – The canceled subscription to reactivate
Throws ​
refreshPaymentHistory()
​
Refresh the subscription payment history for a given subscription.
Arguments ​
$subscription
subscribe()
​
Subscribe user to a plan.
Arguments ​
$user
(craft\elements\User) – The Craft user to subscribe$plan
(craft\commerce\base\Plan) – The plan to subscribe to$parameters
(craft\commerce\models\subscriptions\SubscriptionForm) – Additional parameters to use
Throws ​
- craft\commerce\errors\SubscriptionException
for all subscription-related errors.
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.
Arguments ​
$subscription
(craft\commerce\elements\Subscription) – The subscription to modify$plan
(craft\commerce\base\Plan) – The plan to change the subscription to$parameters
(craft\commerce\models\subscriptions\SwitchPlansForm) – Additional parameters to use