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

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

Signature

public abstract craft\commerce\base\RequestResponseInterface authorize ( craft\commerce\models\Transaction $transaction, craft\commerce\models\payments\BasePaymentForm $form )

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

Signature

public abstract boolean availableForUseWithOrder ( craft\commerce\elements\Order $order )

capture()

Makes a capture request.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

Signature

public abstract craft\commerce\base\RequestResponseInterface capture ( craft\commerce\models\Transaction $transaction, \craft\commerce\base\string $reference )

completeAuthorize()

Complete the authorization for offsite payments.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

Signature

public abstract craft\commerce\base\RequestResponseInterface completeAuthorize ( craft\commerce\models\Transaction $transaction )

completePurchase()

Complete the purchase for offsite payments.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

Signature

public abstract craft\commerce\base\RequestResponseInterface completePurchase ( craft\commerce\models\Transaction $transaction )

createPaymentSource()

Creates a payment source from source data and user id.

View source

Arguments

Returns

craft\commerce\models\PaymentSource

Signature

public abstract craft\commerce\models\PaymentSource createPaymentSource ( craft\commerce\models\payments\BasePaymentForm $sourceData, \craft\commerce\base\int $userId )

deletePaymentSource()

Deletes a payment source on the gateway by its token.

View source

Arguments

Returns

boolean

Signature

public abstract boolean deletePaymentSource ( $token )

getPaymentFormModel()

Returns payment form model to use in payment forms.

View source

Returns

craft\commerce\models\payments\BasePaymentForm

Signature

public abstract craft\commerce\models\payments\BasePaymentForm getPaymentFormModel ( )

processWebHook()

Processes a webhook and return a response

View source

Returns

craft\web\Response

Throws

Signature

public abstract craft\web\Response processWebHook ( )

purchase()

Makes a purchase request.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

Signature

public abstract craft\commerce\base\RequestResponseInterface purchase ( craft\commerce\models\Transaction $transaction, craft\commerce\models\payments\BasePaymentForm $form )

refund()

Makes an refund request.

View source

Arguments

Returns

craft\commerce\base\RequestResponseInterface

Signature

public abstract craft\commerce\base\RequestResponseInterface refund ( craft\commerce\models\Transaction $transaction )

supportsAuthorize()

Returns true if gateway supports authorize requests.

View source

Returns

boolean

Signature

public abstract boolean supportsAuthorize ( )

supportsCapture()

Returns true if gateway supports capture requests.

View source

Returns

boolean

Signature

public abstract boolean supportsCapture ( )

supportsCompleteAuthorize()

Returns true if gateway supports completing authorize requests

View source

Returns

boolean

Signature

public abstract boolean supportsCompleteAuthorize ( )

supportsCompletePurchase()

Returns true if gateway supports completing purchase requests

View source

Returns

boolean

Signature

public abstract boolean supportsCompletePurchase ( )

supportsPartialRefund()

Returns true if gateway supports partial refund requests.

View source

Returns

boolean

Signature

public abstract boolean supportsPartialRefund ( )

supportsPaymentSources()

Returns true if gateway supports payment sources

View source

Returns

boolean

Signature

public abstract boolean supportsPaymentSources ( )

supportsPurchase()

Returns true if gateway supports purchase requests.

View source

Returns

boolean

Signature

public abstract boolean supportsPurchase ( )

supportsRefund()

Returns true if gateway supports refund requests.

View source

Returns

boolean

Signature

public abstract boolean supportsRefund ( )

supportsWebhooks()

Returns true if gateway supports webhooks.

View source

Returns

boolean

Signature

public abstract boolean supportsWebhooks ( )