diff --git a/src/Extension.php b/src/Extension.php index 9e70fc0..aa82315 100644 --- a/src/Extension.php +++ b/src/Extension.php @@ -263,8 +263,17 @@ public function maybe_create_memberpress_transaction( Payment $payment ) { continue; } - if ( $memberpress_gateway->get_payment_method() === $payment->get_payment_method() ) { - $memberpress_subscription->gateway = $memberpress_gateway->id; + $gateway_method = $memberpress_gateway->get_payment_method(); + $payment_method = $payment->get_payment_method(); + + if ( ! \in_array( $gateway_method, [ null, $payment_method ] ) ) { + continue; + } + + $memberpress_subscription->gateway = $memberpress_gateway->id; + + if ( $gateway_method === $payment_method ) { + break; } }