Skip to main content

Hooks and Filters

WordPress and WooCommerce Registration Hooks

plugins_loaded

Used by plugin to:

  • Load translations (stwg_load_textdomain)
  • Initialize gateway registration (stwg_init_gateway, priority 20)

woocommerce_payment_gateways

  • Callback: stwg_register_gateway
  • Effect: adds WC_Gateway_Suma_Test to available payment gateways

Gateway Processing Actions

woocommerce_suma_test_gateway_before_process_payment

Fires before approve/decline branching.

Parameters:

  1. WC_Order $order
  2. WC_Gateway_Suma_Test $gateway

woocommerce_suma_test_gateway_payment_declined

Fires when tester selects decline path.

Parameters:

  1. WC_Order $order
  2. string $transaction_id
  3. WC_Gateway_Suma_Test $gateway

woocommerce_suma_test_gateway_payment_approved

Fires when tester selects approve path.

Parameters:

  1. WC_Order $order
  2. string $transaction_id
  3. string $authorization_code
  4. WC_Gateway_Suma_Test $gateway

woocommerce_suma_test_gateway_after_process_payment

Fires after branch-specific processing.

Parameters:

  1. WC_Order $order
  2. string $result (approve or decline)
  3. WC_Gateway_Suma_Test $gateway

woocommerce_suma_test_gateway_api_callback

Fires when WC API callback endpoint is hit.

Parameters:

  1. WC_Gateway_Suma_Test $gateway

WooCommerce Core Action Triggered by Plugin

woocommerce_payment_failed

Plugin explicitly triggers this action on decline path to ensure ecosystem compatibility for systems listening to payment failure events.

Suggested Integration Uses

  • Attach logging and observability around deterministic test outcomes.
  • Trigger downstream fraud/OTP simulations on decline path.
  • Capture test transaction metadata into QA dashboards.