Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken onboarding with a live account #3335

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions includes/connect/class-wc-stripe-connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function get_oauth_url( $return_url = '', $mode = 'live' ) {
return $result;
}

set_transient( 'wcs_stripe_connect_state', $result->state, 6 * HOUR_IN_SECONDS );
set_transient( 'wcs_stripe_connect_state_' . $mode, $result->state, 6 * HOUR_IN_SECONDS );

return $result->oauthUrl; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
}
Expand All @@ -74,7 +74,7 @@ public function connect_oauth( $state, $code, $mode = 'live' ) {
// The state parameter is used to protect against CSRF.
// It's a unique, randomly generated, opaque, and non-guessable string that is sent when starting the
// authentication request and validated when processing the response.
if ( get_transient( 'wcs_stripe_connect_state' ) !== $state ) {
if ( get_transient( 'wcs_stripe_connect_state_' . $mode ) !== $state ) {
return new WP_Error( 'Invalid state received from Stripe server' );
}

Expand All @@ -84,7 +84,7 @@ public function connect_oauth( $state, $code, $mode = 'live' ) {
return $response;
}

delete_transient( 'wcs_stripe_connect_state' );
delete_transient( 'wcs_stripe_connect_state_' . $mode );

return $this->save_stripe_keys( $response, $mode );
}
Expand Down
Loading