Skip to content

Commit

Permalink
Redirect API-only payment methods to payment action URL (fixes #18).
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Nov 17, 2022
1 parent 80b8705 commit dbe1231
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ public function payment_redirect( Payment $payment ) {
exit;
}

// Redirect API-only payment methods to payment action URL.
$payment_method_type = PaymentMethodType::transform( $payment->get_payment_method() );

if ( $this->can_api_only( $payment_method_type ) ) {
$action_url = $payment->get_action_url();

if ( null !== $action_url ) {
\wp_redirect( $action_url );

exit;
}
}

/**
* Step 1: Create a payment session
*
Expand Down

0 comments on commit dbe1231

Please sign in to comment.