GatewayInterface

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

GatewayInterface defines the common interface to be implemented by gateway classes.

A class implementing this interface should also use \craft\commerce\base\SavableComponentTrait and craft\commerce\base\GatewayTrait.

View source

# 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.
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 user id.
deletePaymentSource() Deletes a payment source on the gateway by its token.
displayName() Returns the display name of this class.
getIsNew() Returns whether the component is new (unsaved).
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.
getTransactionHashFromWebhook() Retrieves the transaction hash from the webhook data. This could be a query string param or part of the response data.
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.
refund() Makes an refund request.
settingsAttributes() Returns the list of settings attribute names.
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
supportsPartialRefund() Returns true if gateway supports partial refund requests.
supportsPaymentSources() Returns true if gateway supports payment sources
supportsPurchase() Returns true if gateway supports purchase requests.
supportsRefund() Returns true if gateway supports refund requests.
supportsWebhooks() Returns true if gateway supports webhooks.
validate() Validates the component.

# authorize()

Makes an authorize request.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

# availableForUseWithOrder()

Returns true if gateway supports payments for the supplied Order.

View source

Arguments

  • $order – Order The order this gateway can or can not be available for payment with.

Returns

boolean

# capture()

Makes a capture request.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

# completeAuthorize()

Complete the authorization for offsite payments.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

# completePurchase()

Complete the purchase for offsite payments.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

# createPaymentSource()

Creates a payment source from source data and user id.

View source

Arguments

Returns

craft\commerce\models\PaymentSource

# deletePaymentSource()

Deletes a payment source on the gateway by its token.

View source

Arguments

Returns

boolean

# getPaymentFormModel()

Returns payment form model to use in payment forms.

View source

Returns

craft\commerce\models\payments\BasePaymentForm

# getTransactionHashFromWebhook()

Since
2.2.21

Retrieves the transaction hash from the webhook data. This could be a query string param or part of the response data.

View source

Returns

mixed

# processWebHook()

Processes a webhook and return a response

View source

Returns

craft\web\Response

Throws

# purchase()

Makes a purchase request.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

# refund()

Makes an refund request.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

# supportsAuthorize()

Returns true if gateway supports authorize requests.

View source

Returns

boolean

# supportsCapture()

Returns true if gateway supports capture requests.

View source

Returns

boolean

# supportsCompleteAuthorize()

Returns true if gateway supports completing authorize requests

View source

Returns

boolean

# supportsCompletePurchase()

Returns true if gateway supports completing purchase requests

View source

Returns

boolean

# supportsPartialRefund()

Returns true if gateway supports partial refund requests.

View source

Returns

boolean

# supportsPaymentSources()

Returns true if gateway supports payment sources

View source

Returns

boolean

# supportsPurchase()

Returns true if gateway supports purchase requests.

View source

Returns

boolean

# supportsRefund()

Returns true if gateway supports refund requests.

View source

Returns

boolean

# supportsWebhooks()

Returns true if gateway supports webhooks.

View source

Returns

boolean