interface OffsitePaymentGatewayInterface in Commerce Core 8.2
Defines the base interface for off-site payment gateways.
Off-site payment flow: 1) Customer hits the "payment" checkout step. 2) The PaymentProcess checkout pane shows the "offsite-payment" plugin form. 3) The plugin form performs a redirect or shows an iFrame. 4) The customer provides their payment details to the payment provider. 5) The payment provider redirects the customer back to the return url. 6) A payment is created in either onReturn() or onNotify().
If the payment provider supports asynchronous notifications (IPNs), then creating the payment in onNotify() is preferred, since it is guaranteed to be called even if the customer does not return to the site.
Note that onReturn() will be skipped if onNotify() was called before the customer returned to the site, completing the payment process and placing the order.
If the customer declines to provide their payment details, and cancels the payment at the payment provider, they will be redirected back to the cancel url.
Hierarchy
- interface \Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\PaymentGatewayInterface; interface \Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\SupportsNotificationsInterface
- interface \Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\OffsitePaymentGatewayInterface
Expanded class hierarchy of OffsitePaymentGatewayInterface
All classes that implement OffsitePaymentGatewayInterface
4 files declare their use of OffsitePaymentGatewayInterface
- OrderPaidSubscriber.php in modules/
payment/ src/ EventSubscriber/ OrderPaidSubscriber.php - PaymentAddForm.php in modules/
payment/ src/ Form/ PaymentAddForm.php - PaymentCheckoutController.php in modules/
payment/ src/ Controller/ PaymentCheckoutController.php - PaymentProcess.php in modules/
payment/ src/ Plugin/ Commerce/ CheckoutPane/ PaymentProcess.php
File
- modules/
payment/ src/ Plugin/ Commerce/ PaymentGateway/ OffsitePaymentGatewayInterface.php, line 31
Namespace
Drupal\commerce_payment\Plugin\Commerce\PaymentGatewayView source
interface OffsitePaymentGatewayInterface extends PaymentGatewayInterface, SupportsNotificationsInterface {
/**
* Gets the URL to the "notify" page.
*
* When supported, this page is called asynchronously to notify the site of
* payment changes (new payment or capture/void/refund of an existing one).
*
* @return \Drupal\Core\Url
* The "notify" page url.
*/
public function getNotifyUrl();
/**
* Processes the "return" request.
*
* This method should only be concerned with creating/completing payments,
* the parent order does not need to be touched. The order state is updated
* automatically when the order is paid in full, or manually by the
* merchant (via the admin UI).
*
* @param \Drupal\commerce_order\Entity\OrderInterface $order
* The order.
* @param \Symfony\Component\HttpFoundation\Request $request
* The request.
*
* @throws \Drupal\commerce_payment\Exception\PaymentGatewayException
* Thrown when the request is invalid or the payment failed.
*/
public function onReturn(OrderInterface $order, Request $request);
/**
* Processes the "cancel" request.
*
* Allows the payment gateway to clean up any data added to the $order, set
* a message for the customer.
*
* @param \Drupal\commerce_order\Entity\OrderInterface $order
* The order.
* @param \Symfony\Component\HttpFoundation\Request $request
* The request.
*/
public function onCancel(OrderInterface $order, Request $request);
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigurableInterface:: |
public | function | Gets default configuration for this plugin. | 11 |
ConfigurableInterface:: |
public | function | Gets this plugin's configuration. | 12 |
ConfigurableInterface:: |
public | function | Sets the configuration for this plugin instance. | 12 |
DependentPluginInterface:: |
public | function | Calculates dependencies for the configured plugin. | 19 |
DerivativeInspectionInterface:: |
public | function | Gets the base_plugin_id of the plugin instance. | 1 |
DerivativeInspectionInterface:: |
public | function | Gets the derivative_id of the plugin instance. | 1 |
OffsitePaymentGatewayInterface:: |
public | function | Gets the URL to the "notify" page. | 1 |
OffsitePaymentGatewayInterface:: |
public | function | Processes the "cancel" request. | 1 |
OffsitePaymentGatewayInterface:: |
public | function | Processes the "return" request. | 1 |
PaymentGatewayInterface:: |
public | function | Builds a label for the given AVS response code and card type. | 1 |
PaymentGatewayInterface:: |
public | function | Builds the available operations for the given payment. | 1 |
PaymentGatewayInterface:: |
public | function | Gets whether the payment gateway collects billing information. | 1 |
PaymentGatewayInterface:: |
public | function | Gets the credit card types handled by the gateway. | 1 |
PaymentGatewayInterface:: |
public | function | Gets the default payment method type. | 1 |
PaymentGatewayInterface:: |
public | function | Gets the payment gateway display label. | 1 |
PaymentGatewayInterface:: |
public | function | Gets the JS library ID. | 1 |
PaymentGatewayInterface:: |
public | function | Gets the payment gateway label. | 1 |
PaymentGatewayInterface:: |
public | function | Gets the mode in which the payment gateway is operating. | 1 |
PaymentGatewayInterface:: |
public | function | Gets the payment method types handled by the payment gateway. | 1 |
PaymentGatewayInterface:: |
public | function | Gets the payment type used by the payment gateway. | 1 |
PaymentGatewayInterface:: |
public | function | Gets the supported modes. | 1 |
PaymentGatewayInterface:: |
public | function | Converts the given amount to its minor units. | 1 |
PluginFormInterface:: |
public | function | Form constructor. | 36 |
PluginFormInterface:: |
public | function | Form submission handler. | 32 |
PluginFormInterface:: |
public | function | Form validation handler. | 18 |
PluginInspectionInterface:: |
public | function | Gets the definition of the plugin implementation. | 4 |
PluginInspectionInterface:: |
public | function | Gets the plugin_id of the plugin instance. | 2 |
PluginWithFormsInterface:: |
public | function | Gets the form class for the given operation. | |
PluginWithFormsInterface:: |
public | function | Gets whether the plugin has a form class for the given operation. | |
SupportsNotificationsInterface:: |
public | function | Processes the notification request. | 1 |