GatewayInterface
- Type
- Interface
- Namespace
- craft\commerce\base
- Extends
- craft\base\SavableComponentInterface (opens new window)
- 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 (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. |
| authorize() | Makes an authorize request. |
| availableForUseWithOrder() | Returns true if gateway supports payments for the supplied Order. |
| 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. |
| 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() (opens new window) | Returns the display name of this class. |
| getIsNew() (opens new window) | Returns whether the component is new (unsaved). |
| getPaymentFormModel() | Returns payment form model to use in payment forms. |
| getSettings() (opens new window) | Returns an array of the component’s settings. |
| getSettingsHtml() (opens new window) | 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() (opens new window) | 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() (opens new window) | 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() (opens new window) | Validates the component. |
# authorize()
Makes an authorize request.
View source (opens new window)
Arguments
$transaction(craft\commerce\models\Transaction) – The authorize transaction$form(craft\commerce\models\payments\BasePaymentForm) – A form filled with payment info
Returns
craft\commerce\base\RequestResponseInterface
# availableForUseWithOrder()
Returns true if gateway supports payments for the supplied Order.
View source (opens new window)
Arguments
$order– Order The order this gateway can or can not be available for payment with.
Returns
# capture()
Makes a capture request.
View source (opens new window)
Arguments
$transaction(craft\commerce\models\Transaction) – The capture transaction$reference(string (opens new window)) – Reference for the transaction being captured.
Returns
craft\commerce\base\RequestResponseInterface
# completeAuthorize()
Complete the authorization for offsite payments.
View source (opens new window)
Arguments
$transaction(craft\commerce\models\Transaction) – The transaction
Returns
craft\commerce\base\RequestResponseInterface
# completePurchase()
Complete the purchase for offsite payments.
View source (opens new window)
Arguments
$transaction(craft\commerce\models\Transaction) – The transaction
Returns
craft\commerce\base\RequestResponseInterface
# createPaymentSource()
Creates a payment source from source data and user id.
View source (opens new window)
Arguments
$sourceData(craft\commerce\models\payments\BasePaymentForm)$userId(integer (opens new window))
Returns
craft\commerce\models\PaymentSource
# deletePaymentSource()
Deletes a payment source on the gateway by its token.
View source (opens new window)
Arguments
$token(string (opens new window))
Returns
# getPaymentFormModel()
Returns payment form model to use in payment forms.
View source (opens new window)
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 (opens new window)
Returns
mixed
# processWebHook()
Processes a webhook and return a response
View source (opens new window)
Returns
craft\web\Response (opens new window)
Throws
- Throwable (opens new window)
if something goes wrong
# purchase()
Makes a purchase request.
View source (opens new window)
Arguments
$transaction(craft\commerce\models\Transaction) – The purchase transaction$form(craft\commerce\models\payments\BasePaymentForm) – A form filled with payment info
Returns
craft\commerce\base\RequestResponseInterface
# refund()
Makes an refund request.
View source (opens new window)
Arguments
$transaction(craft\commerce\models\Transaction) – The refund transaction
Returns
craft\commerce\base\RequestResponseInterface
# supportsAuthorize()
Returns true if gateway supports authorize requests.
View source (opens new window)
Returns
# supportsCapture()
Returns true if gateway supports capture requests.
View source (opens new window)
Returns
# supportsCompleteAuthorize()
Returns true if gateway supports completing authorize requests
View source (opens new window)
Returns
# supportsCompletePurchase()
Returns true if gateway supports completing purchase requests
View source (opens new window)
Returns
# supportsPartialRefund()
Returns true if gateway supports partial refund requests.
View source (opens new window)
Returns
# supportsPaymentSources()
Returns true if gateway supports payment sources
View source (opens new window)
Returns
# supportsPurchase()
Returns true if gateway supports purchase requests.
View source (opens new window)
Returns
# supportsRefund()
Returns true if gateway supports refund requests.
View source (opens new window)
Returns
# supportsWebhooks()
Returns true if gateway supports webhooks.
View source (opens new window)
Returns
← Gateway GatewayTrait →