'error', 'message' => __( 'Invalid security token', 'booktics' ) ] ); } $account_id = isset( $_GET['account_id'] ) ? sanitize_text_field( wp_unslash( $_GET['account_id'] ) ) : ''; $type = isset( $_GET['type'] ) ? sanitize_text_field( wp_unslash( $_GET['type'] ) ) : 'test'; if ( ! $account_id ) { return rest_ensure_response( [ 'status' => 'error', 'message' => __( 'Missing account_id parameter', 'booktics' ) ] ); } if ( ! empty( $account_id ) ) { Settings::update( 'stripe_account_id', $account_id ); Settings::update( 'stripe_account_type', $type ); wp_safe_redirect( admin_url( 'admin.php?page=booktics#/settings?tab=payment' ) ); exit; } return rest_ensure_response( [ 'status' => 'error', 'message' => __( 'Stripe connection failed', 'booktics' ) ] ); } /** * Get the Stripe Connect authorization URL. * * @return string The authorization URL */ public function get_connect_url( $type = 'test' ) { return BOOKTICS_STRIPE_CONNECT_DOMAIN . '/stripe/connect?type=' . $type . '&redirect_uri=' . base64_encode( $this->get_redirect_uri( $type ) ); } }