Skip to content

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.

View source

Public Methods ​

MethodDescription
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.

View source

Arguments ​

Throws ​

getBillingIssueDescription() ​

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

View source

Arguments ​

  • $subscription

getBillingIssueResolveFormHtml() ​

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

View source

Arguments ​

  • $subscription

getHasBillingIssues() ​

Returns whether this subscription has billing issues.

View source

Arguments ​

  • $subscription

getNextPaymentAmount() ​

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

View source

Arguments ​

  • $subscription

Returns ​

string – Next payment amount with currency code

getSubscriptionPayments() ​

Returns a list of subscription payments for a given subscription.

View source

Arguments ​

  • $subscription

Returns ​

craft\commerce\models\subscriptions\SubscriptionPayment[]

getSubscriptionPlanByReference() ​

Returns a subscription plan by its reference

View source

Arguments ​

  • $reference

getSubscriptionPlans() ​

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

View source

reactivateSubscription() ​

Reactivates a subscription.

View source

Arguments ​

Throws ​

refreshPaymentHistory() ​

Refresh the subscription payment history for a given subscription.

View source

Arguments ​

  • $subscription

subscribe() ​

Subscribe user to a plan.

View source

Arguments ​

Throws ​

supportsPlanSwitch() ​

Returns whether this gateway supports switching plans.

View source

supportsReactivation() ​

Returns whether this gateway supports reactivating subscriptions.

View source

switchSubscriptionPlan() ​

Switch a subscription to a different subscription plan.

View source

Arguments ​